日期:2014-05-18 浏览次数:20446 次
DECLARE @Field1 INT, @Field2 INT, @Field3 INT DECLARE MY_CURSOR SCROLL CURSOR --定义一个游标 FOR SELECT field1, field2, field3 FROM [CSDN_1] OPEN MY_CURSOR WHILE @@FETCH_STATUS <> 0 BEGIN FETCH NEXT FROM MY_CURSOR INTO @Field1, @Field2, @Field3 UPDATE [CSDN_1] SET Field1=@Field3, Field2=@Field1, Field3=@field2 WHERE Field1=@Field1 END CLOSE MY_CURSOR DEALLOCATE MY_CURSOR