如何更改 sqlpackage.exe?

发布于 2025-01-13 00:45:31 字数 209 浏览 4 评论 0原文

让我以我不熟悉命令行/powershell 的事实来介绍我的问题。我面临的是我的部署由于可能的数据丢失而失败。根据我的阅读,我可以将变量从 TRUE 更改为 FALSE,但我不知道如何访问 SQLPackage.exe 文件。它是 DevOps 构建服务器上的文件吗?我尝试在本地计算机上创建系统变量但失败了。它没有被识别出来。我需要找到一种方法来解决自动化构建中可能出现的数据丢失问题。 谢谢您的帮助!

Let me preface my problem with the fact that I am not familiar with command line/powershell. What I am up against is that my deployments are failing due to possible data loss. From what I read, I can change a variable from TRUE TO FALSE but I have no idea on how to get to the SQLPackage.exe file. Is it the file on the BUILD SERVER for DevOps? I tried to create a system variable on my local machine and failed. It wasn't recognized. I need to figure out a way to work around the possible data loss issue on automated builds.
Thank you for any help!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仲春光 2025-01-20 00:45:31

您不会在 exe 中更改类似的内容,而是将应用程序配置为按照您希望的方式运行。

有几个选项可以让发布不会因可能的数据丢失而被阻止。例如,如果您要创建 dacpac,则可以在那里指定它。

从命令行运行应用程序时,您可以设置一个命令行参数:

/p: BlockOnPossibleDataLoss=(BOOLEAN 'True')

指定如果结果架构更改可能导致数据丢失(包括由于数据精度降低或需要强制转换操作的数据类型更改),则操作将在架构验证步骤期间终止。默认值 (True) 会导致操作终止,无论目标数据库是否包含数据。如果目标上存在无法转换为新列类型的数据,则在部署计划执行期间,BlockOnPossibleDataLoss 值为 False 的执行仍可能失败。

详细信息:SqlPackage 发布参数、属性和 SQLCMD 变量 - 发布操作的参数

You don't change something like this in the exe, but configure the application to behave the way you want it to behave.

There are a couple of options to have the publish not block on possible data loss. For instance, if you're creating a dacpac you can specify it there.

When running the application from the command line, there's a command line parameter you can set:

/p: BlockOnPossibleDataLoss=(BOOLEAN 'True')

Specifies that the operation will be terminated during the schema validation step if the resulting schema changes could incur a loss of data, including due to data precision reduction or a data type change that requires a cast operation. The default (True) value causes the operation to terminate regardless if the target database contains data. An execution with a False value for BlockOnPossibleDataLoss can still fail during deployment plan execution if data is present on the target that cannot be converted to the new column type.

More information: SqlPackage Publish parameters, properties, and SQLCMD variables - Parameters for the publish action

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文