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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how to find with tsql whether a column is IDENTITY

Author  Topic 

aravindt77
Posting Yak Master

120 Posts

Posted - 2007-08-28 : 04:34:42
Hi All,


how to find with tsql whether a column is IDENTITY column or not

Plz do the needful ASAP

Thanks & Regards

Aravind

aravindt77
Posting Yak Master

120 Posts

Posted - 2007-08-28 : 04:56:51
Atlast I gt it

SELECT IDENT_SEED(OBJECT_NAME(id)) AS seed,
IDENT_INCR(OBJECT_NAME(id)) AS incr,
OBJECT_NAME(id) AS tbl
FROM syscolumns
WHERE (status & 128) = 128
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-28 : 05:14:49
this is the preffered way

select column_name
from information_schema.columns
where table_name = 'Employees'
and columnproperty(object_id(table_name), column_name, 'IsIdentity') = 1


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -