Friday, March 23, 2012

Getdate()??

I declared a @.Start and @.End, and now I want to bring in todays date @.End and 30 days pevious as start... These two commands give me those 2 pieces of data but how do I use(assign) Start and End to these??

SELECT CONVERT(CHAR(10), GETDATE(), 101)
SELECT CONVERT(CHAR(10), GETDATE()-30, 101)DECLARE @.Start char(10), @.End char (10)

SELECT @.Start = CONVERT(CHAR(10), GETDATE(), 101)
SELECT @.End = CONVERT(CHAR(10), GETDATE()-30, 101)

SELECT @.Start, @.End|||how about:
DECLARE @.Start char(10), @.End char (10)
select @.start=getdate()
select @.end = dateadd(m,-1,getdate())
SELECT @.Start as 'start', @.End as 'end'

No comments:

Post a Comment