日期:2014-05-18  浏览次数:20514 次

如何遍历表数据?
SQL code
DECLARE @STR_DetailId    TABLE(DetailId INT,Old BIT)    /*新老子单编号表*/


有这样一表变量,并且往里插入了一些数据,如果遍历它呀?

------解决方案--------------------
遍历它呀?

游標一行行讀取賦值,不賦值時直接讀取 

------解决方案--------------------
循环.....
------解决方案--------------------
SQL code
DECLARE Employee_Cursor CURSOR FOR
SELECT EmployeeID, Title FROM AdventureWorks.HumanResources.Employee;
OPEN Employee_Cursor;
FETCH NEXT FROM Employee_Cursor;
WHILE @@FETCH_STATUS = 0
   BEGIN
      FETCH NEXT FROM Employee_Cursor;
   END;
CLOSE Employee_Cursor;
DEALLOCATE Employee_Cursor;
GO

------解决方案--------------------
游标!
------解决方案--------------------
游标!