“防止保存需要重新创建表的更改”负面影响 [英] "Prevent saving changes that require the table to be re-created" negative effects

查看:145
本文介绍了“防止保存需要重新创建表的更改”负面影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在修改SQL Server 2008中的列,将数据类型从货币(18,0)更改为(19,2)。



我收到了通常的错误您所做的更改需要从SQL Server中删除并重新创建以下表格。我知道在工具 - >选项 - >设计师 - >表和数据库设计器中有选项 - >取消选中禁止保存需要重新创建表的更改但是...



我的问题是这样做:这有没有任何负面影响/可能的缺点?当这个框被取消选中时,表实际上是否被自动删除并重新创建,如果是,新表是旧的100%的完整副本?



谢谢!

解决方案

只有在SQL Server的Management Studio被编程知道的情况下,表才被删除并重新创建如何做到这一点。



肯定会在不需要的情况下执行此操作,但是也会出现在Management Studio中进行编辑的情况将不会删除并重新创建,因为它不必。



问题是枚举所有的情况并确定哪一方他们所在的行将会相当乏味。



这就是为什么我喜欢使用 ALTER TABLE ,而不是隐藏他们' (而且坦白地说有错误) - 我确切知道会发生什么,我可以为那些唯一可能删除并重新创建表的情况做准备(这比SSMS将要多少次)对你)。


I was modifying a column in SQL Server 2008 today, changing the datatype from something like currency(18,0) to (19,2).

I got the usual error "The changes you have made require the following tables to be dropped and re-created" from SQL Server.

I know there is the option in Tools-> Options -> Designer -> Table and Database Designers -> Uncheck the box Prevent saving changes that require table re-creation, but...

My question is this : are there any negative effects / possible drawbacks of doing this? Does the table actually get dropped and recreated automatically when this box is unchecked, and if so, is the new table a 100% exact copy of the old one?

Thanks!

解决方案

The table is only dropped and re-created in cases where that's the only way SQL Server's Management Studio has been programmed to know how to do it.

There are certainly cases where it will do that when it doesn't need to, but there will also be cases where edits you make in Management Studio will not drop and re-create because it doesn't have to.

The problem is that enumerating all of the cases and determining which side of the line they fall on will be quite tedious.

This is why I like to use ALTER TABLE in a query window, instead of visual designers that hide what they're doing (and quite frankly have bugs) - I know exactly what is going to happen, and I can prepare for cases where the only possibility is to drop and re-create the table (which is some number less than how often SSMS will do that to you).

这篇关于“防止保存需要重新创建表的更改”负面影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆