Skip navigation

How can I tell what columns in my SQL Server database are identity columns?

A. The following scripts work on SQL 6.5.

To show all identity columns :-

select o.name, c.name from <dbname>..syscolumns c, <dbname>..sysobjects o
where c.id=o.id and (c.status & 128)=128

To tell the identity seed : select ident_seed('<tblname>')

To tell the identity increment : select ident_incr('<tblname>')


TAGS: SQL
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish