Comments
1 comment
-
Official comment
Hi NSRjecross
Thank you for reaching out on the Redgate forums regarding your odd SQL Prompt behaviour.
That initially sounds like SQL Prompt’s Find Invalid Objects feature is getting confused due to name caching or some kind of indexing issue, leading to incorrect object names in the script preview.
Here are some possible suggestions to clear this variance:
-
Force Refresh SQL Prompt's Cache
- In SSMS, go to SQL Prompt → Refresh Suggestions (or
Ctrl + Shift + D
). - This should clear cached object names and reload them.
- In SSMS, go to SQL Prompt → Refresh Suggestions (or
-
Manually Verify the Views
- Run:
SELECT name FROM sys.views WHERE name LIKE '%Vein%';
- Check if any unexpected naming inconsistencies exist at the database level.
- Run:
-
Check for Ghost Entries in sys.sql_modules
- If the objects were renamed recently, stale metadata could be an issue.
- Run:
SELECT object_id, definition FROM sys.sql_modules WHERE object_id IN (SELECT object_id FROM sys.views);
- See if any unexpected names appear.
-
Try SSMS’s Built-in Scripting Instead
- If SQL Prompt's Find Invalid Objects is unreliable, use SSMS:
- Right-click the invalid view → Script as ALTER
- Compare with what SQL Prompt generates.
- If SQL Prompt's Find Invalid Objects is unreliable, use SSMS:
-
Check SQL Prompt’s Log File for Errors
- Logs are usually in
%LOCALAPPDATA%\Red Gate\SQL Prompt\Log\
. - Look for errors or inconsistencies.
- Logs are usually in
-
Test with a New SSMS Session
- Restart SSMS and load Find Invalid Objects again.
- If possible, test on another machine to rule out local corruption.
-
Force Refresh SQL Prompt's Cache
Add comment
Please sign in to leave a comment.
An example is we have a broken view called dbo.VW_Vein1Ass
In the invalid objects panel it correctly lists it as VW_Vein1Ass but in the script view at the bottom, it says " CREATE VIEW dbo.VV_Vein1Ass" . Using the script as alter it generates code that says "ALTER VIEW dbo.VV_Vein1Ass"
Using the ssms script view as alter generates code "ALTER VIEW [dbo].[VW_Vein1Ass]"
This happens on a variety of view messing up the names in different ways, not just the prefix.
In one case it seems to have swapped names from one bad object to another in the script (script uses the name of the next bad object in the script and the next object script has the name of the view above) (corruption within the list of items, not just corruption of the single object name)
Any suggestions?