code_junkie

Where are seed_value and increment_value for IDENTITY columns?

Nov 11th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. CREATE TABLE ident_test (
  2. test_id int IDENTITY(1000,10),
  3. other int
  4. )
  5.  
  6. SELECT name, seed_value, increment_value
  7. FROM sys.identity_columns
  8. WHERE object_id = OBJECT_ID( 'ident_test' )
  9.  
  10. SELECT c.name, i.seed_value, i.increment_value
  11. from sys.identity_columns i
  12. join sys.columns c
  13. ON i.object_id = c.object_id
  14. AND i.column_id = c.column_id
  15.  
  16. SELECT c.name, i.seed_value, i.increment_value
  17. FROM sys.columns c
  18. INNER JOIN sys.identity_columns i
  19. ON i.object_id = c.object_id
  20. AND i.column_id = c.column_id
  21.  
  22. INNER JOIN sys.tables t
  23. ON t.object_id = c.object_id
Add Comment
Please, Sign In to add comment