Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine if a SQL table has an identity column
Message
From
09/03/2000 18:38:58
 
 
To
09/03/2000 16:57:07
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00343873
Message ID:
00343934
Views:
18
>>How do I determine if a table in a database has an identity column. If it does -- how do I determine what the seed and increment is?
>>
>>Thanks
>>
>>Gar
>
>I should have added that I not only need to know whether there is an identity column, but which column it is.
>
>Thanks
>
>Gar


I 99% answered my own question
select top 1;
      ident_seed('mytable'),;
      ident_incr('mytable'),;
      identitycol ;
     FROM mytable  
Row 1, col 1 of my result set is indenty seed.
Row 1, col 2 of my result set is indentity increment.
Row 1, col 3 of my result set does not contain the answer: The identity name is the NAME of column 3, not the contents.

The damn thing is doing exactly what I told it to, instead of reading my mind and doing what I want it to <g>.

So what is the syntax to get that identity column name into the result set, rather than just the name of a column?

Thanks
Thanks

Gar W. Lipow
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform