You are here: Re: Identity Column in INFORMATION_SCHEMA or the sys tables « MsSQL Server « IT news, forums, messages
Re: Identity Column in INFORMATION_SCHEMA or the sys tables

Posted by kb on 09/10/07 17:15

>> Where can one find the identity column for a table in the
>> INFORMATION_SCHEMA or the sys tables? Or is there a function that can
>> return the name or id of the identity column for a particular table?
>
> SELECT name
> FROM sys.columns
> WHERE object_id=OBJECT_ID('dbo.YourTableHere','U') AND is_identity=1


SQL 7.0 / 2000 version:


SELECT name
FROM dbo.syscolumns
WHERE id=OBJECT_ID('dbo.YourTableHere','U') AND
COLUMNPROPERTY(id,name,'IsIdentity')=1


--
Tom
http://kbupdate.info/ | http://suppline.com/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация