Viewing 15 posts - 31 through 45 (of 1,922 total)
I have edited the function to add the extra columns u asked for and laso add an Input Parameter. If you wnat to get last 3 months from the current...
August 1, 2012 at 12:59 pm
THis?
IF OBJECT_ID (N'dbo.LastThreeMonths', N'IF') IS NOT NULL
DROP FUNCTION dbo.LastThreeMonths;
GO
CREATE FUNCTION dbo.LastThreeMonths()
RETURNS TABLE
AS
RETURN
WITH CurrentDate AS
(
SELECT ThisMonthFirstDay = DATEADD( MM, DATEDIFF(MM,0,GETDATE()) ,0)
)
, Numbers(N) AS
(
...
August 1, 2012 at 12:00 pm
Like this?
-- Input variables
DECLARE @StarteDate datetime
DECLARE @EndDate datetime
SET @StarteDate = '1/1/2012'
SET @EndDate = '12/31/2020'
-- local variables and initialization
DECLARE @Diff INT
SELECT @Diff =...
July 31, 2012 at 7:51 pm
I sense that the last two values are proper/accurate.. do you sense some discrepancy there Lynn?
July 30, 2012 at 2:49 pm
sestell1 (7/30/2012)
LEN(Reverse(<string>) is a quick and dirty way to find the length of a string INCLUDING trailing whitespace.
Instead, you can use DATALENGTH function to get the length, inlcuding white spaces
DECLARE...
July 30, 2012 at 1:28 pm
I use it mostly to parse out the file names from a long file path. Example:
DECLARE @FilePath VARCHAR(100)
SET @FilePath = 'C:\Users\abcd\AppData\Local\Temp\Temp.txt'
SELECT REVERSE(LEFT ( REVERSE(@FilePath) , CHARINDEX('\',REVERSE(@FilePath))))
Instead of finding the last...
July 30, 2012 at 10:51 am
Will always the first two characters be alphabets ? and will it always be two characters?
July 30, 2012 at 10:40 am
wats your expected results based on the sample you provided?
July 27, 2012 at 1:22 pm
how to identify which states touch wich values?
July 26, 2012 at 7:21 pm
Hello Iduvall,
I see that my earlier code works for your new data set too. Did you take the latest version?
I initially posted a version and then edited it for bug...
July 24, 2012 at 1:22 pm
Canazei65 (7/20/2012)
July 20, 2012 at 9:51 am
Cross post. Please direct your replies here : http://www.sqlservercentral.com/Forums/Topic1332694-392-1.aspx
July 20, 2012 at 12:11 am
Viewing 15 posts - 31 through 45 (of 1,922 total)