需要更改表的步骤

发布于 2024-08-18 21:40:37 字数 97 浏览 4 评论 0原文

每当我更改 SSMS 中的表结构时,就会发出警报:

不允许保存更改。您对下表所做的更改将被删除并重新创建。

Whenever I make changes to a table structure in SSMS, there is a alert raised:

saving the changes is not permitted.the changes u have been made to the following tables to be dropped and recreate..

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

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

发布评论

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

评论(2

夏九 2024-08-25 21:40:37

某些更改会导致表被删除并重新创建。一个这样的示例是将一列添加到表的中间而不是末尾。

您可以执行以下两种操作之一:

选项 1

使用 TSQL 进行更改并将列添加到末尾(或用于特定编辑的等效非表删除选项)

选项 2< /strong>

更改 SSMS 的默认行为(警告 - 这在生产环境中是非常危险的事情)

打开 SQL Server 2008 Management Studio (SSMS)。在菜单中,转到工具/选项。在导航窗格中,展开设计器,然后选择“表和数据库设计器”。

在“表选项”下,取消选中“防止保存需要重新创建表的更改”选项,然后单击“确定”。

Some changes cause a table to be dropped and recreated. One such example is adding a column to the middle of a table rather than to the end.

You can do one of two things:

Option 1

Use TSQL to make your changes and add the column to the end (or the equivalent non table-drop option for your specific edit)

Option 2

Alter the default behavior of SSMS (warning - this is a very dangerous thing in production environments)

Open SQL Server 2008 Management Studio (SSMS). In the menu, go to Tools / Options. In the Navigation pane, expan Designers, and select "Table and Database Designers".

Under Table options, uncheck “Prevent saving changes that require the table re-creation” option and click OK.

白馒头 2024-08-25 21:40:37

我发现当您所做的更改可能可能导致数据被截断时,最常出现此类消息。因此,如果您将 nvarchar(20) 更改为 nvarchar(10),就会出现这种情况。如果列只包含 2 个字符长的数据也没关系,它只查看数据类型。该消息可能还有其他原因和其他风格,但大多数情况下它们都遵循相同的推理:如果更改会导致表在其可以保存的数据方面受到更多限制,那么它需要进行彻底的手术。

I've seen those kinds of messages most often come up when the changes you are making could potentially cause data to be truncated. So, if you were changing an nvarchar(20) to nvarchar(10), that would come up. It doesn't matter if the column only contains data that is 2 characters long, it only looks at the data type. There may be other reasons and other flavors of that message, but mostly they follow the same reasoning: If the change would cause the table to be more restricted in the data it could hold, it wants to do radical surgery.

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