@@RowCount returns the number of rows affected by the last statement (BOL).
The documentation does not specify behaviour for FOR XML clause in the SELECT statement. When FOR XML clause is used, the behaviour is the same. The FOR XML clause converts the result into one row, but @@RowCount contains number of all affected rows in the SELECT statement.
1 2 3 4 5 6 7 8 9 10 | SELECT Top 100 [number] FROM [master].[dbo].[spt_values] ORDER BY [number] Asc FOR XML PATH('') SELECT @@ROWCOUNT --100 |
Leave a Reply