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 RunningAhead.com. I don’t think I’m completely loading the XML data yet, and I don’t have database tables to load [...]
Archives for sql server
Sql Date Time formats.
Fromhttp://lists.evolt.org/archive/Week-of-Mon-20020617/115646.html 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 yy.mm.dd 3 103 British/French dd/mm/yy 4 104 German dd.mm.yy 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 [...]
Further refined version of code searching
I have now included views in the search code version. Both functions now return the object type the result was found in. –Searches stored procedures, functions and views for code– containing the stringtosearchCREATE FUNCTION findTextInCode (@StringToSearch varchar(100))RETURNS @fNames TABLE (search varchar(100), name sysname, type char(2))ASBEGIN SET @StringToSearch = ‘%’ + @StringToSearch +’%’ INSERT @fNames SELECT [...]
Functions to find text in column names and in stored procedures and function definitions
Implemented in SQL Server:This function finds a text string in a stored procedure or function definition: CREATE FUNCTION Find_Text_In_SP_or_FN (@StringToSearch varchar(100))RETURNS @fNames TABLE (name sysname)ASBEGIN SET @StringToSearch = ‘%’ + @StringToSearch +’%’ INSERT @fNames SELECT DISTINCT SO.Name FROM sysobjects SO (NOLOCK) INNER JOIN syscomments SC (NOLOCK) on SO.ID = SC.ID AND (SO.Type = ‘P’ OR [...]
Posts