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

Stuck in master...

Dave PendletonDave Pendleton Posts: 104 Bronze 3
edited January 15, 2008 2:21PM in SQL Prompt Previous Versions
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...


  • Options
    Bart ReadBart Read Posts: 997 Silver 1
    Thanks Dave,

    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:


    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.

    Bart Read
    Principal Consultant
    bartread.com Ltd
Sign In or Register to comment.