如何在表格的特定位置添加一列? [英] how to add a column at a specific position in a table?

查看:48
本文介绍了如何在表格的特定位置添加一列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
SQL Server 2008:无法在中间位置插入新列并更改数据类型

我正在使用 SQL SERVER 2008 &2008 R2 我想使用alter 命令在表中的特定位置添加一列.有什么方法可以使用关键字在特定位置添加列吗?谢谢!进阶.

Hi i am using SQL SERVER 2008 & 2008 R2 i would like to add a column in a table at a specific position using alter command. is there any way keyword using which we can add a column at a specific position ? thanks! in adavanced.

推荐答案

在 sql server 中不太容易..

Not very easy in sql server..

我认为最好的方法是在表的末尾添加列并创建一个具有所需列顺序的视图..

I think the best way is to add the column at the end of the table and create a view with desired order of columns..

另一种选择..

将所有数据放在临时表中,并以正确的列顺序重新创建实际表,然后将数据从临时表插入到实际表中

put all the data in a temp table and recreate the actual table with correct column order, then insert the data back to the actual table from temp table

这篇关于如何在表格的特定位置添加一列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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