Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
While @@FETCH_STATUS = 0 not working?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
While @@FETCH_STATUS = 0 not working?
Divers
Thread ID:
00637507
Message ID:
00637507
Vues:
49
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform