How to: Connect to a Database and Browse Existing Objects
A very common task for database administrators and developers is to connect to a live database, design or browse its schema and query against its objects. The SQL Server Object Explorer in Visual Studio now contains a dedicated SQL Server node, under which all connected SQL Server instances and their databases are grouped in an SSMS-like hierarchy. The connected SQL Server instances can be an on-premises one, such as running SQL Server 2008 or an off-premise SQL Azure instance.
The following procedure assumes that you already have the AdventureWorks sample database installed. Use GitHub to locate and install sample databases for different SQL Server versions. If you prefer, you can also follow the steps and use an existing database on your server.
To connect to a database instance
In Visual Studio, make sure that SQL Server Object Explorer is open. If it is not, click the View menu and select SQL Server Object Explorer.
Right-click the SQL Server node in SQL Server Object Explorer and select Add SQL Server.
In the Connect to Server dialog box, enter the Server name of the server instance you want to connect to, your credentials, and click Connect.
In SQL Server Object Explorer, expand the Databases node under your server instance. You will see all the databases residing in this server instance added under this Databases node.
Expand the AdventureWorks (or another database) node. You will notice that all the database entities are organized in a hierarchy similar to SQL Server Management Studio.