DECLARE @Counts INT select @Counts =rows from sysindexes where id = object_id('IpAddress') and indid in (0,1)