SQL Server 2000 cursor usage

xiaoxiao2021-03-06  51

Use db1declare my_cursor cursor scroll dynamic / * scroll indicates that the cursor pointer (otherwise only moving forward), Dynamic means reading and writing a cursor (otherwise the cursor read only) * / forselect Name from profile

open my_cursordeclare @name sysnamefetch next from my_cursor into @namewhile (@@ fetch_status = 0) begin print 'Name:' @name fetch next from my_cursor into @name endfetch first from my_cursor into @nameprint @ name / * update personal data set name = 'zzg' where current of my_cursor * // * delete from profile Where current of my_cursor * / close my_cursordeallocate my_cursor

转载请注明原文地址:https://www.9cbs.com/read-91190.html

New Post(0)