在 SQL Server 2005 中的现有列之后添加新列的 SQL 查询 [英] SQL Query to add a new column after an existing column in SQL Server 2005

查看:52
本文介绍了在 SQL Server 2005 中的现有列之后添加新列的 SQL 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个 SQL 查询,它在现有列之后添加一个新列,因此该列将按特定顺序添加.

I need a SQL query which add a new column after an existing column, so the column will be added in a specific order.

请建议我是否有任何 ALTER 查询可以做到这一点.

Please suggest me if any ALTER query which do that.

推荐答案

Microsoft SQL (AFAIK) 不允许您更改表并在特定列之后添加列.最好的办法是使用 Sql Server Management Studio,或者尝试删除和重新添加表,或者创建一个新表并手动移动数据.两者都不是很优雅.

Microsoft SQL (AFAIK) does not allow you to alter the table and add a column after a specific column. Your best bet is using Sql Server Management Studio, or play around with either dropping and re-adding the table, or creating a new table and moving the data over manually. neither are very graceful.

MySQL但是:

ALTER TABLE mytable
ADD COLUMN  new_column <type>
AFTER       existing_column

这篇关于在 SQL Server 2005 中的现有列之后添加新列的 SQL 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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