How to change the default connection to a server in Visual studio 2012 SQL Project?

28,385

Solution 1

Check the properties of your database project. Under Debug tab, there's option "Target Connection String". Change that to the server and database you want to use.

Solution 2

To change default connection

  1. On the menu, choose Tools-> Options -> Database tools
  2. On the data connections enter the SQL server Instance name that you want to use
  3. Press OK

this is from http://xprog.blogspot.com/2012/08/visual-studio-2012-change-default-sql.html

To change connection on a file by file basis

This worked for me. I had a sql file with BuildAction=Build and it was missing the sql connection toolbar.

  1. in solution explorer, click on the sql file
  2. change its BuildAction to None
  3. open the file (if its already open, close and reopen)

now you will get the connection toolbar.

you will have to remember to change the build action back when you are done with your maintenance.

Solution 3

To change the default db In Solution Explorer, right click on your DB project, select Properties Go to Debug Tab Under 'Target Connection String' click EDIT enter you sql server details and save.

Share:
28,385
suresh2
Author by

suresh2

https://suresh2.com

Updated on February 25, 2020

Comments

  • suresh2
    suresh2 about 4 years

    In visual studio 2012 sqlproj, the default connection button always connect to the (localdb)\Projects by default. How do I change that? Every time I need to disconnect and connect again to change the server.