SQL Server 2008:无法将新列插入中间位置并更改数据类型 [英] SQL Server 2008 : Cannot Insert new column in the middle position and change data type

查看:199
本文介绍了SQL Server 2008:无法将新列插入中间位置并更改数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的操作系统是Windows Server 2008。



我已经安装了SQL Server Express 2008。



我有几个问题:


  1. 我无法在中间位置插入新列。如果我插入最后一个,我可以保存表格设计。

  2. 我可以更改列名,但是我不能更改数据类型。

我收到错误讯息:
不允许保存更改。您所做的更改需要删除和重新创建以下表。您已对表进行了更改,无法重新创建或启用了预防保存需要重新创建表的更改的选项。



示例: p>

我有 ID,姓名,电话,状态列。我无法在名称电话之间添加地址



但是,如果我放在状态地址 $ c>。



有没有办法解决这个问题?




解决方案

在SSMS工具 - >选项 - >设计师中,您需要取消选中禁止保存需要重新创建表的更改才能允许您可以在SSMS中执行此操作。



这将重建表,因此如果表格非常庞大,通常不值得麻烦,并将部署到生产更加棘手。



如果有逻辑上您希望彼此相邻的列可以让您更容易地撰写查询,则可以使用所需的列顺序创建一个视图。 >

My OS is Windows server 2008.

I've already installed SQL Server Express 2008.

I have several problems:

  1. I can't insert a new column in the middle position. If I insert in the last one, I can save the table design.
  2. I can change the column name but I can't change the data type.

I got error message : Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be recreated or enabled the option Prevent saving changes that require the table to be re-created.

Example:

I have ID, Name, Phone, and Status columns. I am unable to add Address between Name and Phone.

But, I can add Address if i place it after Status.

Is there any way to solve this problem?

Thanks before.

解决方案

In SSMS Tools -> Options -> Designers you would need to uncheck the option "Prevent Saving Changes that require table re-creation" to allow you to do this in SSMS.

This will rebuild the table and so generally isn't worth the hassle if the table is at all large and will make deployment to production trickier.

If there are columns which logically you would prefer to have next to each other to make writing queries easier you can create a View with the desired column order.

这篇关于SQL Server 2008:无法将新列插入中间位置并更改数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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