hi,
is there any better way to find the existence of an index or stats then pls tell me.
IF NOT EXISTS (SELECT 1
FROM sys.indexes I
WHERE I.Name = 'XI_Status_Abb_ListDom' -- Index name
AND I.object_id = OBJECT_ID('ListDomain'))
IF NOT EXISTS ( SELECT * FROM sys.stats
WHERE name = 'stat_PipePipeIdParentPipeIdStatusLength'
AND object_ID = OBJECT_ID ('Pipe'))
yours sincerely