且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在SQL中的两列之间添加列

更新时间:2022-11-27 15:38:13

您实际上无法做到这一点-您必须构建一个临时表,将信息转移过来,然后从该临时表中重建旧表. .

话虽这么说,列顺序仍然没有关系-除非您使用"SELECT * FROM ..."并依赖于返回数据中的列号,否则这首先是一件非常非常愚蠢的事情! />
您要达到什么目的,以为您认为这是必要的并且是个好主意?
You can''t actually do that - you would have to build a temporary table, transfer the information over, and then rebuild the old table from the temporary.

Having said that, column order should not matter anyway - unless you are using "SELECT * FROM ..." and relying on column number in the returned data, which is a very, very silly thing to do in the first place!

What are you trying to achieve that you think this is necessary, and a good idea?


请参阅以下内容:
http://blog.sqlauthority.com /2008/04/08/sql-server-change-order-of-column-in-database-tables/ [
Refer to this:
http://blog.sqlauthority.com/2008/04/08/sql-server-change-order-of-column-in-database-tables/[^]


使用 ALTER TABLE [