Viewing 9 posts - 1 through 9 (of 9 total)
Christopher Stobbs (4/21/2009)
so for example if you run the query at 2009-04-21 16:38.59
Then anything before 16:38.59 on the 2009-04-14 will...
April 21, 2009 at 9:48 am
Christopher Stobbs (4/21/2009)
Could you post the solution?this will help any others searching for a similar solution
well I just did this.
where table.column1 = 'xxx' and (column2 between getdate() -7 and...
April 21, 2009 at 9:28 am
Christopher Stobbs (4/21/2009)
April 21, 2009 at 9:18 am
Christopher Stobbs (4/21/2009)
--Month
WHERE [YourDate] BETWEEN
DATEADD(mm, DATEDIFF(mm,0,DATEADD(mm,-1,GETDATE())), 0)
AND DATEADD(ms,-3,DATEADD(mm, DATEDIFF(mm,0,GETDATE()), 0))
The from part of the date:
Step 1: DATEADD(mm,-1,GETDATE() = get the date...
April 21, 2009 at 8:54 am
Christopher Stobbs (4/21/2009)
--Month
WHERE [YourDate] BETWEEN
DATEADD(mm, DATEDIFF(mm,0,DATEADD(mm,-1,GETDATE())), 0)
AND DATEADD(ms,-3,DATEADD(mm, DATEDIFF(mm,0,GETDATE()), 0))
--Year
WHERE [YourDate] BETWEEN
DATEADD(yy, DATEDIFF(yy,0,DATEADD(yy,-1,GETDATE())), 0)
AND DATEADD(ms,-3,DATEADD(yy, DATEDIFF(yy,0,GETDATE()), 0))
Just so you know...
April 21, 2009 at 8:26 am
Christopher Stobbs (4/21/2009)
Do you mean the following
today's date = 23/03/2009
Therefore Last year = any day in 2008
Therefore Last month = andy...
April 21, 2009 at 8:07 am
ShuaThe2nd (4/21/2009)
The following select statement should give you the dates you are after;
SELECT DATEADD(YYYY, -1, DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0)) AS [Last Year],
DATEADD(dd, DATEDIFF(dd, 0, GETDATE()), 0) AS...
April 21, 2009 at 7:45 am
Christopher Stobbs (4/21/2009)
Look up on BOL for the following datetime functionsDATEADD()
DATEDIFF()
see how you get on...
I have already tryied that, but no luck, can't manage to get it working. can you...
April 21, 2009 at 6:56 am
yes, i already implemented that, but I having problems editing the code to add this costum fields, as i said I not a developer, and the code development is very...
March 18, 2009 at 5:14 am
Viewing 9 posts - 1 through 9 (of 9 total)
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy