Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
poolpie
Starting Member
2 Posts |
Posted - 2009-02-19 : 11:28:42
|
Hello,In a stored procedure, I need to know if a table contains an IDENTITY.It seems this information is not in syscolumns.Do you know where this property is stored?Thanks |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-19 : 11:35:03
|
[code]SELECT nameFROM syscolumns WHERE COLUMNPROPERTY(id,name, 'isIdentity') = 1AND OBJECT_NAME(id)='your table name here'[/code] |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-19 : 11:45:27
|
Lists all table with Identity Properties:Select [name] from sys.objects Where type = 'U'and OBJECTPROPERTY(OBJECT_ID([name]),'Tablehasidentity') = 1and [name] not like 'dt%' and [name] not like 'sys%'Order by [name] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-19 : 12:02:34
|
quote: Originally posted by sodeep Lists all table with Identity Properties:Select [name] from sys.objects Where type = 'U'and OBJECTPROPERTY(OBJECT_ID([name]),'Tablehasidentity') = 1and [name] not like 'dt%' and [name] not like 'sys%'Order by [name]
for sql 2000 use sysobjects instead of sys.objects |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-19 : 12:27:17
|
quote: Originally posted by visakh16
quote: Originally posted by sodeep Lists all table with Identity Properties:Select [name] from sys.objects Where type = 'U'and OBJECTPROPERTY(OBJECT_ID([name]),'Tablehasidentity') = 1and [name] not like 'dt%' and [name] not like 'sys%'Order by [name]
for sql 2000 use sysobjects instead of sys.objects
Y right. Nowdays have a habit in SQL 2005 |
|
|
poolpie
Starting Member
2 Posts |
Posted - 2009-02-19 : 12:46:55
|
Thanks all! ;-) |
|
|
|
|
|