Reputation: 47763
Is there a way to connect to a specific database rather than just connect to a SQL Server? There are a ton of databases and each time I have to search though the long list to find mind which is stupid. There has to be a way to specify server\DBName right? I searched the web but couldn't not find how to do this when trying to connect to server in SQL Server's connect dialog.
Upvotes: 0
Views: 7149
Reputation: 31
In SQL Management Studio 20 is possible to pass additional parameters for the connection string.
At the tab "Additional Connection Parameters", add the parameter "Initial Catalog", wich inform the specific database to connect
Initial Catalog=yourdatabasename
Upvotes: 0
Reputation: 721
Even though this is an old question, I would like to add that you can filter out the amount of databases that you see when you log in. It is still not the best solution to my own liking but it helps to speed up my database searching quest when going through databases hosted at a shared hosting provider.
Also, keep in mind that you need to do this every time you log in.
Step 1) Right after logging in to your named instance, right-click on Databases -> Filter -> Filter Settings
Step 2) Type in the name of your database in the Value field for the property Name then click OK
Step 3) Done. Now expand the Databases folder again and your database should appear very promptly and with no additional databases.
Additionally, instead of using Microsoft SQL Server Management Studio I also use LINQPad to quickly open and query through my databases. However, LINQPad isn't SQL Server Management Studio, so you'll have to get used to that.
Upvotes: 1
Reputation: 1161
You can pass parameters to SQL Server Management Studio:
ssms.exe -S <SERVERNAME> -d <DATABASENAME> -U <USERNAME> -P <PASSWORD>
As per the comments, you can create a shortcut and set the params there.
This is the full help listing:
ssms.exe [-S server_name[\instance_name]] [-d database] [-U user] [-P password] [-E] [file_name[, file_name]] [/?]
[-S The name of the SQL Server instance to which to connect] [-d The name of the SQL Server database to which to connect] [-E] Use Windows Authentication to login to SQL Server [-U The name of the SQL Server login with which to connect] [-P The password associated with the login] [file_name[, file_name]] names of files to load [-nosplash] Supress splash screen [/?] Displays this usage information
Upvotes: 1
Reputation: 24378
I think you're asking about if Sql Server Management Studio can use
a specific database when you connect to a server...
That is a setting per "login". In SSMS, edit the properties of your login (under security > logins) and on the "general" tab there is a "default database" drop down. It is probably set to master, you can set it to the database you want used by default on your next connection.
EDIT
Try something along these lines...
ALTER LOGIN login_name WITH DEFAULT_DATABASE = database
http://msdn.microsoft.com/en-us/library/ms189828.aspx
Upvotes: 1