Monday, February 20, 2012

TSQL - counter/increment/rownumber

Here is a fairly easy way to get a row number in SQL Server (2005 or later):

DECLARE @seed INT = 100

SELECT

@seed + ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) AS RowNumber

,*

FROM sys.sysobjects

No comments:

Post a Comment