Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Row Number starting from 1000

Author  Topic 

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2012-02-16 : 00:23:43
hi

How do I generate row number starting from 1000?

I have a CTE code but it won't work. thanks a lot

With productIndex AS
(
Select IDENTITY(int,1000,1) as RN, Distinct(ProdID) as ProdID
FROM dbo.Product

)

Select * from productIndex

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-02-16 : 01:22:44
use

row_number() over ( order by ...) + 1000


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -