Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Debugging a WHILE EXISTS
Message
 
À
02/11/2008 16:11:29
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01358902
Message ID:
01359038
Vues:
42
>>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform