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 |
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-08-31 : 13:28:56
|
| I need to search the datetime field to find is a specific year is equal to the year provided by the user??DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
|
cat_jesus
Aged Yak Warrior
547 Posts |
Posted - 2009-08-31 : 13:38:56
|
| Select * from sometablewhere year(datecolumn) = '2009'An infinite universe is the ultimate cartesian product. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-01 : 03:16:06
|
| or if you want to make use of index (if defined)declare @year intset @year =2009Select * from sometablewhere datecolumn >= DATEADD(YEAR,@year-1900,0) and datecolumn < DATEADD(YEAR,@year-1900+1,0)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|