Technical Article

Tables with Identity Columns

,

Run this script on the Database where you are trying to identify Tables with Identity columns.

SQL SERVER 2000 SP3a

declare @tablename varchar(200)

declare tables cursor for
select table_name from information_Schema.tables

open tables

fetch next from tables
into @tablename

print'/******************************************************************************/'
print'/*The following tables all have identity columns      */'
print'/******************************************************************************/'
while @@fetch_status = 0
begin
if(objectproperty(object_id(@tablename), 'tablehasidentity'))=1
begin
print @tablename
end

fetch next from tables
into @tablename
end

close tables
deallocate tables

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating