That's already the right way.
i have to find existence of an index and stats.
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
1 additional answer
Sort by: Most helpful
-
Seeya Xi-MSFT 16,461 Reputation points
2021-08-20T07:28:57.643+00:00 Hi @rajesh yadav ,
The following method cannot be better and detailed, but it can be used for your reference.
Usesp_helpindex
Best regards,
Seeya
If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar queries.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.