![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there a way to read a system table to determine if a specific table has an identity column? Derek Hart |
#3
| |||
| |||
|
|
Is there a way to read a system table to determine if a specific table has an identity column? Derek Hart |
#4
| |||
| |||
|
|
Is there a way to read a system table to determine if a specific table has an identity column? Derek Hart |
#5
| |||
| |||
|
|
Is there a way to read a system table to determine if a specific table has an identity column? Derek Hart |
#6
| |||
| |||
|
|
Derek Hart wrote: Is there a way to read a system table to determine if a specific table has an identity column? Derek Hart Always state what version you are using. In 2000: ... EXISTS (SELECT * FROM dbo.syscolumns AS C WHERE id = OBJECT_ID('dbo.tablename') AND COLUMNPROPERTY(id,name,'IsIdentity')=1) ; In 2005: ... EXISTS (SELECT * FROM sys.identity_columns WHERE object_id = OBJECT_ID('dbo.tablename')) ; -- David Portas, SQL Server MVP Whenever possible please post enough code to reproduce your problem. Including CREATE TABLE and INSERT statements usually helps. State what version of SQL Server you are using and specify the content of any error messages. SQL Server Books Online: http://msdn2.microsoft.com/library/m...S,SQL.90).aspx -- |
![]() |
| Thread Tools | |
| Display Modes | |
| |