Stuck in master...
Dave Pendleton
Posts: 104 Bronze 3
I am working on a ~3000 line script that references objects in several other databases, including master.
I am refactoring the code as I go, primarily adding object ownership qualifiers via the "Qualify Object Names" function of SQL Refactor.
At some point, SQL Prompt becomes convinced that I am in the master database (even though I am not) and does not suggest any objects from any other database but master.
The only way to remedy this is to close the file and reopen it, but after several more refactor operations, I'm back to master...
I am refactoring the code as I go, primarily adding object ownership qualifiers via the "Qualify Object Names" function of SQL Refactor.
At some point, SQL Prompt becomes convinced that I am in the master database (even though I am not) and does not suggest any objects from any other database but master.
The only way to remedy this is to close the file and reopen it, but after several more refactor operations, I'm back to master...
Comments
It sounds like it might perhaps be losing track of the USE statements (if you have any). The best thing I can suggest as a workaround is that rather than closing and reopening the file you could execute the following series of keystrokes in your editor window:
CTRL+A, CTRL+X, CTRL+V
This obviously cuts and pastes the entire file, which will be quicker for you than reopening, but the key thing is the way it looks to SQL Prompt. It will appear as if you've deleted the entire contents of the script, which you have, and pasted in an entirely new script. This will force SQL Prompt to reparse the file and should mean that it will correctly infer which database you're working with. There will obviously still be some delay whilst SQL Prompt does this.
If this doesn't work it would suggest that the file contains syntax errors (hopefully not introduced by SQL Refactor!) that are confusing SQL Prompt. To test for this you can simply try to parse the file using CTRL+F5, or the blue check mark button on the toolbar (should be next to Execute unless you've customised your toolbars).
Hope that helps.
Thanks,
Bart
Principal Consultant
bartread.com Ltd