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 |
|
brmcdani44
Starting Member
4 Posts |
Posted - 2012-01-30 : 15:03:05
|
Hello, I am having trouble figuring out how to use the beginning of the year in the follow where statement. Any help will be appreciated.WHERE datetime BETWEEN '1/1/' + YEAR(@BegDate) AND @EndDate) |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-01-30 : 15:16:39
|
| [code]BETWEEN DATEADD(YEAR,DATEDIFF(YEAR,'19000101',@begDate),'19000101') AND @EndDate[/code] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-01-30 : 17:07:58
|
| i prefer >= and < rather than BETWEEN when I work with datetime fields------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|