|
|
Question : GetDate??
|
|
I have a query in SQL server 2005 that I run every day. Can I change the values below to pull the date from the system rather than having to change them each day?
set @rundate = '2006-04-21' -- Today set @startdate = '2006-04-20 12:00:00' --Yesterday 12 PM set @enddate = '2006-04-20 12:00:00' --Today 12 PM
The Start and End dates have to use 12:00 PM
Can I use the GetDate function to set this up??
Please help as this is urgent.
Scotto13
|
Answer : GetDate??
|
|
select @today = convert(varchar(10),getdate(),120), @startDate = CAST(convert(varchar(10),getdate(),120)+' 12:00:00' as datetime) -1 , @endDate = CAST(convert(varchar(10),getdate(),120)+' 12:00:00' as datetime)
|
|
|
|
|