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 |
|
scmay
Starting Member
22 Posts |
Posted - 2007-08-08 : 20:57:06
|
| DECLARE CareModel_cursor cursor FOR SELECT DISTINCT ObAnteEvent.UrNoFROM ObBabyEpisode INNER JOIN ObAnteEvent ONObAnteEvent.UrNo = ObBabyEpisode.UrNo AND ObAnteEvent.EpisodeID = ObBabyEpisode.EpisodeIDWHERE ObAnteEvent.EventType='CareModel' ORDER BY EventDate,EventTime AND CONVERT(DateTime,ObBabyEpisode.BirthDate,103)>= Convert(DateTime,'1/1/2000',103) AND CONVERT(DateTime, ObBabyEpisode.BirthDate,103)<= Convert(DateTime,'1/1/2007',103) Error is at 'AND ObAnteEvent.EpisodeID = ObBabyEpisode.EpisodeID' Why is this a problem and how do I solve this? |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-08-08 : 21:07:43
|
| What was the error message? What's sql version and sp level? |
 |
|
|
scmay
Starting Member
22 Posts |
Posted - 2007-08-08 : 21:08:49
|
| Server: Msg 156, Level 15, State 1, Line 5Incorrect syntax near the keyword 'AND'.SQL 2000/SQL Express 2005 gave same error.sp level? What is that.? |
 |
|
|
scmay
Starting Member
22 Posts |
Posted - 2007-08-08 : 21:33:30
|
| error found.wrong location of ORDER BY |
 |
|
|
|
|
|