Considerations for Offline Editing
You can use the Transact-SQL editor even if you are offline, that is, not connected to a database. For example, you can still use the editor to edit scripts and queries if you are working remotely, if your database server is down, or if you want to reduce the number of active connections to your database. In addition, when you use the editor to edit the database objects that are defined in your database project, you are working offline. However, not all functionality is available when you are working in an offline (disconnected) state.
Editing Database Scripts and Queries
If you open a session of the Transact-SQL editor that is not connected to a database, the window title and the property browser indicate that you are disconnected. However, you can still use the editor to create and edit database queries and scripts.
To create a query, you open the Data menu, point to Transact-SQL Editor, and then click New Query Connection. Before the editor opens, the Connect to Server dialog box appears, prompting you for the server against which you want to run your script or query. However, you can click Cancel to close the dialog box and use the Transact-SQL editor when disconnected.
To edit a query or a script, you open the File menu, point to Open, and click File. You then specify a .sql file for editing. For example, you can edit scripts that you generated by comparing database schemas.
You must connect to a database server to validate or execute any scripts or queries against databases on that server. If you try to validate or execute a query without connecting to a database server, the Connect to Database Engine dialog box appears. Also, the window title and the property browser might not immediately reflect that you are disconnected from a database if your connection fails unexpectedly (for example, if your server was taken offline). In that case, the Connect to Server dialog box appears the next time that you try to perform an operation that requires a connection.