Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Seriously though, Query Analyser in Sql Server 2000 behaved exactly the same way and this behaviour was carried through to 2005 and 2008
Don't know about version 7 - I only ever did some basic admin work on that
"it will open a session to which ever database you are currently connected to"
hmmmm..in theory, yes. i still think my copy of ssm studio has an attitude problem though.
try clicking on a db in the object explorer then click on new query
see which db you are connected to
then with the query window active click new query
see which db you are connected to
select a different db in the object explorer and click new query (whilst the object explorer window is still maintaining the application focus)
again see which db you are connected to
"it will open a session to which ever database you are currently connected to"
hmmmm..in theory, yes. i still think my copy of ssm studio has an attitude problem though.
"use "dbname""
i know, i know. i ought to do this but sometimes....you just want to be productive and get on with things...something about haste and speed comes to mind
when you click on new query (or hit control-N) it will open a session to which ever database you are currently connected to. This is not constrained to the query windows.
So if you were browsing the live system in the object explorer tree and the window focus was on there then SSMS will open a DB connection to the Live database.
Once you understand the behaviour you'll realise its not just switching... its doing what it is supposed to do and it does it very consitantly.
As JoJoGabor pointed out though - adding the use <dbname> will make sure your scripts are always diverted to the correct database (unless your running a partial section of the query by highlighting then executing)
this thing has a mind of it's own. it keeps switching the active database so that unless you're *really* careful, you can end up running a script against a database other than the one you think you are!!!!! grrrrrr
Leave a comment: