Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
fralo
Posting Yak Master
161 Posts |
Posted - 2012-02-15 : 16:56:10
|
Hi all,I'm trying to acquire the previous day's date and place it in variable. Is it as simple as the following, or something similar?set @yesterday= CONVERT(varchar(8), getdate()-1, 112) |
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2012-02-16 : 01:35:43
|
or useselect dateadd(d,-1,getdate()) |
 |
|
fralo
Posting Yak Master
161 Posts |
Posted - 2012-02-16 : 11:05:53
|
So are you saying that my code would work as well? |
 |
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2012-02-17 : 01:43:45
|
Yes ;it give you the last day in varchar data type |
 |
|
|
|
|