Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Way to view DB name in SQL Query Analyzer

Status
Not open for further replies.

k108

Programmer
Joined
Jul 20, 2005
Messages
230
Location
US
When I used to use Oracle, the only tool available at the time for running queries was - I can't even remember the name now. Sigh.

Anyhow, there was a way to set a configuration file so that every time you opened the tool (the name of which I can no longer remember), the cursor would show:

DATABASE NAME> "type your sql command here"

Which was really nice, because you knew EXACTLY which machine you were on and you wouldn't accidentally issue a statement to the wrong database.

Does SQL Query Analyzer have any such option?

Thanks
 
AFAIK, there is no such option but can always db_name() to find out the database you are working on.
 
But if you are using query analyzer it should have current database as one of the toolbar buttons right?
 
Yeah, it shows on the top, I just like to see it in the cursor itself. More goofproof this way. Perhaps some of the non-gui tools allow this, but I don't use them.

With oracle, I set it up to show:

MACHINENAME:DBNAME>

It was cool.
 
Yea, I know you can define it in the login.sql or glogin.sql files.

I have been an oracle person myself for a long time but have enjoyed working with sql server too. The best part is that many limitations in sql server in comparison with oracle will cease with sql server 2005.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top