;WITH CTE AS ( SELECT * FROM TableName ) Select @RecordCount = Count(*) from CTE Select * from CTE
DECLARE @rcount INT = 0 SELECT @rcount = COUNT(*) FROM TableName --it would return the count of records SELECT @rcount AS RecordCout
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)