How come SQL Prompt doesn't flag Invalid Synonyms in the 'Find Invalid Objects' routine

It is easy enough
<div>SELECT DB_NAME() AS DBName, Name AS Synonym, base_object_name AS RefersTo,
'DROP SYNONYM ' + SCHEMA_NAME( schema_id) + '.' + Name + ';' AS Fix
<span style="background-color: transparent; color: inherit; font-size: inherit; font-family: roboto, &quot;helvetica neue&quot;, Arial, sans-serif;">FROM sys.synonyms</span></div><div><span style="background-color: transparent; color: inherit; font-size: inherit;"><font face="roboto, helvetica neue, Arial, sans-serif">WHERE DB_ID( PARSENAME( base_object_name, 3 ) ) IS NULL</font>
</span><span style="background-color: transparent; color: inherit; font-size: inherit; font-family: roboto, &quot;helvetica neue&quot;, Arial, sans-serif;">ORDER BY Name;</span></div>


SQLOzzie
Tagged:

Answers

  • Hi @Ozzie,

    Thanks for your post!

    I'm afraid the way that the "find invalid objects" feature is currently written, it's not possible to check the validity of a synonym (the correctness of synonym goes beyond the current mechanism scope).

    To request this feature, could you please add a request to our uservoice forum here so that others can vote to add it as well?

    Thank you!

    Jessica Ramos

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Sign In or Register to comment.