|
Hi there
I need to run an SQL 2000 query where the data it returns is for todays date - 2 days i.e 2 days ago
Can anyone help?
|
|
|
I think you can do something like the following:
convert(varchar,substring(convert(varchar, getdate(), 121),1,4) + substring(convert(varchar, getdate(), 121),6,2) +
cast(cast(substring(convert(varchar, getdate(), 121),9,2)) as Integer) - 2) as varchar(2).
It's going to be just a bit more complicated to make sure that you have the right month and year, in case today's date is something like January 1st.
Romel Evans
|
|
|
|
|
Thanks for yor response guys, I have tried both ways and they both work perfect thanks for your help
Tim
|
|
|
Hi readers,
This is very mysterious query, i also faced that kind of problem when i was doing mcsa certification, then i called my friend for help, he did it correct, i will ask to him for this query;
Thanks
|
|
|
|
|
|
|
|