Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create a temporary cursor for inserting rows
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00920800
Message ID:
00930035
Vues:
10
Hi,

Thank you for your idea. That's another way to solve the problem.

Luis



>Hi Luis,
>
>I use a temporary cursor table and insert my results into a pre-defined table. To enable multiple users to post and retrieve their results into this table, I also added a field for user_id.
>
>
>DECLARE @var1 char(2),@var2 numeric(18,2)
>
>DECLARE cursorname CURSOR FOR select_statement
>
>OPEN cursorname
>
>FETCH NEXT FROM cursorname INTO @var1,@var2
>
>WHILE @@FETCH_STATUS=0
>BEGIN
>
> INSERT INTO pre_defined_table (field1,field2) values (@var1,@var2)
>
> FETCH NEXT FROM cursorname INTO @var1,@var2
>
>END
>
>CLOSE cursorname
>DEALLOCATE cursorname
>
>
>Junjun
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform