SQL reads a table set with a cursor, and SQL reads the set with a cursor
Go
Declare @ auid uniqueidentifier, @ name varchar (Max) --- define the variable
Declare auth_cur cursor for -- defines the cursor
Select ID, [FirstMenu] from [dbo]. [MenuList]
Open auth_cur -- open the cursor
Fetch next from auth_cur into @ auid, @ name -- the variable corresponds to the queried Field
While (@ fetch_status = 0)
Begin
Print @ auid upload ---------------------------------------------------------------------------------------------
Print 'name: '+ @ name
Insert into MenuFeature values (NEWID (), 'readable ', 2, @ auid, 0) -- get the operation to erase each data record in the loop
Insert into MenuFeature values (NEWID (), 'writeable ', 3, @ auid, 0 )------------------------------
Fetch next from auth_cur into @ auid, @ name -- reinitialize the variable value
End
Close auth_cur
Deallocate auth_cur
Go