Friday, March 9, 2012

Question on Idenity Columns

Is there a way to query any system tables, like sysobjects, for User tables
with Identity columns?
We have a SQL2000 server that we want to replicate. One of my tasks is to
identify all tables with Identity columns that are missing the 'not for
replication' clause.

Thanks,

JoeyDJoeyD (joeydba@.yahoo.com) writes:
> Is there a way to query any system tables, like sysobjects, for User
> tables with Identity columns? We have a SQL2000 server that we want to
> replicate. One of my tasks is to identify all tables with Identity
> columns that are missing the 'not for replication' clause.

SELECT object_name(id), name
FROM syscolumns
WHERE columnproperty(id, name, 'IsIdentity') = 1
AND columnproperty(id, name, 'IsIdNotForRepl') = 1

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

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Erland - Thank you for your reply.

JoeyD

"Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
news:Xns961D3C9067A9Yazorman@.127.0.0.1...
> JoeyD (joeydba@.yahoo.com) writes:
> > Is there a way to query any system tables, like sysobjects, for User
> > tables with Identity columns? We have a SQL2000 server that we want to
> > replicate. One of my tasks is to identify all tables with Identity
> > columns that are missing the 'not for replication' clause.
> SELECT object_name(id), name
> FROM syscolumns
> WHERE columnproperty(id, name, 'IsIdentity') = 1
> AND columnproperty(id, name, 'IsIdNotForRepl') = 1
>
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp

No comments:

Post a Comment