February 29, 2012 at 11:22 pm
Comments posted to this topic are about the item Generate consecutive numbers
March 1, 2012 at 1:57 am
In my case (not being an administrator, or maybe it's just our new SQL 2005 database) the master.sys.columns only has 44 rows, and the query only supplies 85,184 rows (44 cubed).
If it had only 3 more rows it would have reached the 100,000 mark.
But using the INFORMATION_SCHEMA.COLUMNS view with 4140 rows worked fine, and would give up to 70,000,000,000 consecutive numbers.
March 4, 2012 at 11:53 am
Oh, be careful, now...
That's why I use sys.all_columns. Even on a brand new instance, it contains more than 4,000 rows when all features are installed correctly and it doesn't matter which database is the current database so long as you have the necessary privs.
INFORMATION_SCHEMA.COLUMNS, on the other hand, can have zero rows in it on a new database and certainly a whole lot less than 4,000 rows.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 11, 2016 at 6:51 am
This is actually pretty cool. It's a great lesson on the use of ROW_NUMBER and OVER which I rarely get a chance to use.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply