Category: sql server

  • Importing a runningahead log.xml into SQL Server 2005 using OPENXML

    I don’t currently have a work-based use for 2005, so I thought I’d use the only readily available collection of data that I have at my disposal… my running log. This is an export file from I don’t think I’m completely loading the XML data yet, and I don’t have database tables to load […]

  • Sql Date Time formats.

    From withoutcentury (yy) withcentury(yyyy) standard outputformat – 0 or 100 (*) default mon dd yyyy hh:miAM (or PM) 1 101 USA mm/dd/yy 2 102 ANSI 3 103 British/French dd/mm/yy 4 104 German 5 105 Italian dd-mm-yy 6 106 – dd mon yy 7 107 – mon dd, yy 8 108 – hh:mm:ss – […]

  • Calculate average daily mileage required to make yearly goal

    This might be useful if you’re programming a running site. For me, however, I wanted to write this calculation in SQL Server to expand my knowledge some. –Calculates the average daily mileage needed to meet a target yearly mileage goal, based on current mileage.CREATE FUNCTION averageDistanceNeeded (@targetMileage decimal(10,4), @currentMileage decimal(10,4))RETURNS decimal(10,4)ASBEGIN Declare @daysLeft decimal(10,4) Declare […]