Posted By

g8rpal on 09/10/10


Tagged

function rownumber


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Autogenerate identity column via Select


 / Published in: SQL
 

URL: http://www.sqlservercentral.com/Forums/Topic980975-338-1.aspx

  1. ;WITH Tens AS
  2. (
  3. SELECT 1 N UNION ALL
  4. SELECT 1 UNION ALL
  5. SELECT 1 UNION ALL
  6. SELECT 1 UNION ALL
  7. SELECT 1 UNION ALL
  8. SELECT 1 UNION ALL
  9. SELECT 1 UNION ALL
  10. SELECT 1 UNION ALL
  11. SELECT 1 UNION ALL
  12. SELECT 1
  13. )
  14.  
  15. SELECT ROW_NUMBER() OVER(ORDER BY (SELECT 0)) RN FROM Tens

Report this snippet  

You need to login to post a comment.