Reply to Re: Is there a way to check if INDENTITY is enabled on a table?

Your name:

Reply:


Posted by Erland Sommarskog on 11/27/07 22:44

CK (c_kettenbach@hotmail.com) writes:
> Is there a way to check if INDENTITY is enabled on a table?
>
> I want to provide a table name and see if Identity (Autonumber) is enabled
> on it. Is this possible?

There are several ways. The quickest is probably

SELECT CASE WHEN ident_current('tbl') IS NOT NULL
THEN 'Has identity'
ELSE 'Nope'
END

You can also use objectproperty, or look in sys.columns (SQL 2005 only).


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

[Back to original 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

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