我使用 RedGate SQL 数据比较并生成了一个 .sql 文件,所以我可以在我的本地机器上运行它.但问题是文件超过 300mb,这意味着我无法进行复制和粘贴,因为剪贴板将无法处理它,并且当我尝试在 SQL Server Management Studio 中打开文件时出现错误关于文件太大.
I use RedGate SQL data compare and generated a .sql file, so I could run it on my local machine. But the problem is that the file is over 300mb, which means I can't do copy and paste because the clipboard won't be able to handle it, and when I try to open the file in SQL Server Management Studio I get an error about the file being too large.
有没有办法运行一个大的 .sql 文件?该文件基本上包含两个新表的数据.
Is there a way to run a large .sql file? The file basically contains data for two new tables.
从命令提示符启动 sqlcmd
:
sqlcmd -S <server> -i C:<your file here>.sql
只需将
替换为您的 SQL 框的位置,并将
替换为您的脚本名称.不要忘记,如果您使用的是 SQL 实例,则语法是:
Just replace <server>
with the location of your SQL box and <your file here>
with the name of your script. Don't forget, if you're using a SQL instance the syntax is:
sqlcmd -S <server>instance.
这是您可以传递 sqlcmd 的所有参数的列表:
Here is the list of all arguments you can pass sqlcmd:
Sqlcmd [-U login id] [-P password]
[-S server] [-H hostname] [-E trusted connection]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w screen width]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]
[-c cmdend] [-L[c] list servers[clean output]]
[-q "cmdline query"] [-Q "cmdline query" and exit]
[-m errorlevel] [-V severitylevel] [-W remove trailing spaces]
[-u unicode output] [-r[0|1] msgs to stderr]
[-i inputfile] [-o outputfile] [-z new password]
[-f | i:[,o:]] [-Z new password and exit]
[-k[1|2] remove[replace] control characters]
[-y variable length type display width]
[-Y fixed length type display width]
[-p[1] print statistics[colon format]]
[-R use client regional setting]
[-b On error batch abort]
[-v var = "value"...] [-A dedicated admin connection]
[-X[1] disable commands, startup script, environment variables [and exit]]
[-x disable variable substitution]
[-? show syntax summary]
这篇关于如何导入大型 MS SQL .sql 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!