The script must be open in the SQL and XQuery editor.
The database that a script is connected to determines the information that is available when you use content assist. Your database connection also might affect the results when you run the SQL or XQuery statement. SQL and XQuery statements can be validated independently of the database connection.
The connection string for the current database is shown on the left in the top border of the editor.
To disconnect a script from a database in the SQL and XQuery editor:
The script that is open in the SQL and XQuery editor is not connected to a database. No connection string is shown in the top border of the editor.
If you want to validate the statements in the script while it is not connected to a database, select the parser to use on Validation page of the Command pane.