What are the challenges you face when working across database platforms? Take the survey
Options

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

OzzieOzzie Posts: 46 Bronze 5
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</div><div>FROM sys.synonyms</div><div>WHERE DB_ID( PARSENAME( base_object_name, 3 ) ) IS NULL</div><div>ORDER BY Name;</div>


SQLOzzie
Sign In or Register to comment.