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 […]