Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Debugging a WHILE EXISTS
Message
 
To
02/11/2008 16:11:29
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01358902
Message ID:
01359038
Views:
40
>>Maybe I'm missing something here, but the loop will slow down the whole operation.
>
>Yes, but this thread has been created to obtain help on a loop process as this is what I need. :) Also, this is some code that I will execute manually on some servers one time only and it will only run for a few seconds.


:-)
And just because I don't like cursors :-)
DECLARE @lcField Char(40)
DECLARE @lcField2 Char(40)
DECLARE @lnNumero Integer
DECLARE @lnNumero2 Integer
DECLARE @loRecord nvarchar(128)

DECLARE @crsRelation TABLE (Numero (the type here), 
                           Field  (type here), 
                           Field2 (type here),
                           ID int IDENTITY(1,1))
INSERT INTO crsRelation
SELECT Numero,Field,Field2 FROM Relation
DECLARE @id int, @maxid int
SELECT @maxid = MAX(Id) FROM @crsRelation
SET @Id = 1
WHILE @Id <= @MaxId
      BEGIN
         SELECT .....
          

         SET @Id = @Id + 1
      END
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform