Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
While @@FETCH_STATUS = 0 not working?
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
While @@FETCH_STATUS = 0 not working?
Miscellaneous
Thread ID:
00637507
Message ID:
00637507
Views:
50
I am back at this one agian. 2 cursors

cursor 1 pulls ID's and start/end time times.

I get 4 patients with start and end times from an answer form. So far so good!

I then take that against a details table in a second cursor.

select z.duration from ds_sleep.dbo.TBL_ACTIGRAPH_FILE_DETAILS z
where z.file_id = (select file_id from ds_sleep.dbo.TBL_ACTIGRAPH_FILES
where registration_id = @pt_id )
and z.date_time between @rundate and dateadd(n,6,@rundate)

I have ONE patient that does not have their detail in this file. Why won't the While @@FETCH_STATUS = 0 prevent the crunching of that data? Is there another alternative to a cursor with nothing in it ?

I tried an if Exists ( ) but that won't work on the above query:
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

TIA

__Stephen
Next
Reply
Map
View

Click here to load this message in the networking platform