gpt4 book ai didi

sql - 如何导入大型 MS SQL .sql 文件?

转载 作者:行者123 更新时间:2023-12-01 16:22:17 25 4
gpt4 key购买 nike

我使用 RedGate SQL 数据比较并生成一个 .sql 文件,因此我可以在本地计算机上运行它。但问题是该文件超过 300mb,这意味着我无法进行复制和粘贴,因为剪贴板无法处理它,当我尝试在 SQL Server Management Studio 中打开该文件时,出现错误关于文件太大。

有没有办法运行大型 .sql 文件?该文件基本上包含两个新表的数据。

最佳答案

从命令提示符处启动sqlcmd :

sqlcmd -S <server> -i C:\<your file here>.sql 

只需替换 <server>以及您的 SQL 框的位置和 <your file here>与你的脚本的名称。不要忘记,如果您使用 SQL 实例,语法是:

sqlcmd -S <server>\instance.

以下是您可以传递 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]

关于sql - 如何导入大型 MS SQL .sql 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/431913/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com