Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Debugging a WHILE EXISTS
Message
 
 
To
02/11/2008 14:18:01
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01358902
Message ID:
01359017
Views:
40
This message has been marked as a message which has helped to the initial question of the thread.
>>The EXISTS operator only checks if there are any records for specified conditions. It cannot return data. I'm not sure why do you need loop in the first place. Try
>>
>>UPDATE r SET NoField = f.Numero 
>>	FROM Relation r 
>>JOIN Field f ON r.Field = f.Field
>>
>>UPDATE r SET NoField2 = f.Numero 
>>	FROM Relation r 
>>JOIN Field f ON r.Field2 = f.Field
>>
>
>Ok, thanks, but I need to apply more logic. So, I need to select the records at first and loop. What adjustment would I need to do to support that?

I think you would need to select them into the cursor then. See DECLARE CURSOR topic in BOL.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform