如何使我的 SQL Server Management Studio 接受 .sql 文件
我有一个 .sql 文件需要输入到我的数据库中,但我找不到如何操作。
我正在使用 SQL Server Management Studio R2,但没有找到任何有关如何添加它的选项。
当我尝试附加它时,我被告知该文件不是主数据库文件,所以我不能这样做......
编辑:好的,我执行了脚本。那行得通。
I have a .sql file I need to enter in to my database, but I can't find how to do it.
I'm using SQL Server Management Studio R2, but haven't found any options on how to add it.
When I try to attach it, I'm told that this file isn't a primary database file, so I can't do it...
EDIT: okay, I had the script execute. That worked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
.SQL
文件是包含 SQL 命令的脚本文件。要运行这些命令,您需要转到菜单:FILE
,然后OPEN
和FILE...
,浏览并选择 .SQL 文件它会打开它,然后您可以运行它(F5
)。确保当前数据库是您希望在其中发生这些命令的数据库。A
.SQL
file is a script file that contain SQL commands. To run those commands you need to go to the menu:FILE
, thenOPEN
andFILE...
, browse and select the .SQL file and it will open it, you can then run it (F5
). Make sure the current database is the one where you want those commands to occur within..sql
文件是脚本,而不是数据库。A
.sql
file is a script, not a database.这对你有用吗?
在 Management Studio 中,单击菜单文件 ->打开->文件->导航到该文件。
文件打开后,您可以单击 F5 运行 SQL。
Will this work for you?
In Management Studio, click on menu File -> Open -> File -> navigate to the file.
After the file has opened, you can click F5 to run the SQL.
.sql 文件通常是可以针对数据库运行的脚本(DML、DDL、其他命令)。它可以创建对象、数据库、添加或删除数据。您可以在 SSMS 中打开它(文件...打开)(或在任何文本编辑器中查看它),然后执行它(仔细检查脚本后)。
A .sql file is usually a script (DML, DDL, other commands) which can be run against a database. It may create objects, databases, add or remove data. You can open it (File...Open) in SSMS (or view it in any text editor) and then execute it (after carefully reviewing the script).
文件->打开,浏览到文件,加载它。确保在编辑器上方的下拉框中选择了正确的数据库。 F5 执行。
File->Open, browse to the file, load it. Make sure the right database is selected in the drop-down box above the editor. F5 to execute.