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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-08-21 : 10:29:02
|
| martin writes "This is probably a very easy question, but as i am a sql dunce could you answer this.I want to run a query aganst a date (format dd/mm/yy)so that it generates a monthly report. how do i query the date format so that it only returns entries within a specific month ?thanks mc" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2002-08-21 : 12:01:13
|
| Is the date character in that format or a datetime?if a datetimefrom tblwhere datepart(mm,dte) = @monthnoif charfrom tblwhere datepart(mm,convert(datetime,dte,103)) = @monthnodo a similar thing for the year if necessarycould alsodeclare @startdate datetimeselect @startdate = '1 sep 2002' ,from tblwhere dte >= @startdateand dte < dateadd(mm, 1, @startdate)==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|