declare @tablename varchar(100)

set @tablename = ‘Product’

if exists (select 1 from sys.columns sc inner join sys.objects so on so.Object_Id = sc.Object_Id where  sc.name = ‘Id’ and sc.is_identity = 1 and so.Type = ‘U’ and so.Name = @tablename)

begin

  print ‘Table has an identity column named id’

end

This can be used to determine if the reseed function can be called on a table.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.