简体   繁体   中英

how to connect to a server after opening a .sql script in SQL Management Studio

in Microsoft SQL Server Management Studio, I use File -> Open -> File (Ctrl + o) to open a.sql script, which includes a list of select statements. However, when I try to run them it complains that it's not connected to any server. What should I do?

Usually I right click a server in the Object Explorer panel (to the left) and select New Query . But that will open a new tab. In theory I could then copy-paste the codes from the previously opened.sql file to the new tab. But that's not what I'm looking for.

Thx!

There are several ways to get there. One is to right-click inside the query window, then choose Connection -> Change Connection...

File -> Open -> File with New Connection is one way

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM