14 May, 2009
0 Comments
0 categories
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.
Tags: SQL Server