In sql server we can know
total numbers of rows or records only in static cursor. For example:
CREATE TABLE Employee(
EmpID BIGINT IDENTITY PRIMARY KEY,
EmpName VARCHAR(100)
)
INSERT Employee VALUES('Scott'),('Greg'),('Davis')
DECLARE EmpCursor CURSOR LOCAL STATIC FOR
SELECT EmpName FROM Employee
OPEN EmpCursor
SELECT @@CURSOR_ROWS AS
TotalRows
Output:
TotalRows
|
3
|
No comments:
Post a Comment