首页 > 代码库 > sql的游标用法举例(Cursor)

sql的游标用法举例(Cursor)

sql的游标用法举例

 

DECLARE @Name varchar(40), @TrueName varchar(20)Declare authors_cursor CursorFor    Select Name,TrueName    From   AccountOpen authors_cursorFetch Next From authors_cursorINTO @Name, @TrueNameWhile @@FETCH_STATUS = 0Begin    Print @TrueName+CONVERT(Varchar(10),@@FETCH_STATUS)              Fetch Next From authors_cursor    INTO @Name, @TrueNameEndClose authors_cursorDeallocate authors_cursor

 

sql的游标用法举例(Cursor)