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 |
|
Julie19
Starting Member
32 Posts |
Posted - 2012-06-29 : 11:38:06
|
| I get the error"Operand type clash: date is incompatible with int" when I run the following procedure.CREATE PROCEDURE GetSurvey @startdate date, @enddate dateASSELECT cast(month(Completion_date)as varchar(2)) +'/'+cast(day(Completion_date)as varchar(2)) +'/'+cast(year(Completion_date)as char(4)) as Completion_Dt,[Rep D]as Rep_IDFROM dbo.XYZ as ABCinner join (select max(year(Completion_Date)) as CurYr,max(month(Completion_Date)) as CurMthFROM dbo.XYZ) as Curon month(completion_date)=Cur.CurMth and year(completion_date)=Cur.CurYr Where [Survey Type] = '123' and Completion_date >= @startdate and Completion_date < (@enddate + 1)GROUP BY Completion_Date, [Rep ATTUID]order by Completion_Date desc, [Rep ATTUID] |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-06-29 : 11:53:53
|
Change your WHERE clause to this:... WHERE [Survey Type] = '123' AND Completion_date >= @startdate AND Completion_date < DATEADD(dd,1,@enddate)... |
 |
|
|
Julie19
Starting Member
32 Posts |
Posted - 2012-06-29 : 13:05:42
|
| Thank you |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-06-29 : 13:29:49
|
| Very welcome .) |
 |
|
|
|
|
|