-2

i'm trying to write a procedure to insert multiple rows in a table using cursors. for example, i have multiple deals numbers DosNum (D1,D2,D3,D4) for each deals we have DosID (001,002,003,004) in a table folder

i want to get all these DosID then insert into another table (file) multiple values (constant, same values) using DosID each time

thank you

for d in (select e.Dosid from Folder e where e.DosNum in ('D1','D2','D3','D4')) loop insert INTO file (DosID,FName,FType) values (d.Dosid,'constant_name_file','constant_name_type')

1 Answers1

0

Refer to this link to check cursor in stored procedure -- https://www.sqlservertutorial.net/sql-server-stored-procedures/sql-server-cursor/