Create Number Table in SQL Server

Posted by Neerajprasadsharma under Sql Server category on | Points: 40 | Views : 3966
This is the amazing Number table which is very effective in solving challenging problems in SQL Server.
I will use this in my series to build the base tables, so here is the code below:

Create table Numbers (N Int Primary Key Clustered)

insert into Numbers
TOP 500000 Convert ( Varchar (50) , Row_Number () Over (Order By S1.number ) )

FROM master.dbo.spt_values s1
CROSS JOIN master.dbo.spt_values s2

Comments or Responses

Posted by: Subhasisd1 on: 10/14/2017 Level:Starter | Status: [Member] | Points: 10
Can u send the complete source code and database to

Login to post response