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 |
|
jjchan
Starting Member
5 Posts |
Posted - 2008-05-19 : 03:10:15
|
| hai friends,iam doing a project in .net and using sql server.i need to compare only month and year part in datetime type to retrive data.1)retrive unique year and its months available in the database. like may 2008 apr 2008 mar 2007 |
|
|
PeterNeo
Constraint Violating Yak Guru
357 Posts |
Posted - 2008-05-19 : 03:13:31
|
| Hi try thisSelect Distinct DateName(DW, Col) as 'Month', Year(Col) as 'Year'From tblOrder By Col |
 |
|
|
jjchan
Starting Member
5 Posts |
Posted - 2008-05-20 : 00:11:45
|
| thanks mate ill try this |
 |
|
|
jjchan
Starting Member
5 Posts |
Posted - 2008-05-20 : 01:04:51
|
it worked perfect for my need after these changes Select Distinct DateName(mm, Col) as 'Month',Year(Col) as 'Year'From tblOrder By Distinct DateName(mm, Col) thanks once again |
 |
|
|
|
|
|