且构网

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

如何修改表sql server?

更新时间:2023-12-01 16:14:10

请参阅w3schools.com上的 SQL ALTER TABLE语句 [ ^ ]。
See the SQL ALTER TABLE statement at w3schools.com[^].






如果您要在最后添加列,没有问题,您只需要在select语句中进行更改。



无论如何你仍然想要这样做,你可以按照下面的说法去做。



1.使用SQL Server管理工作室



2.您还可以查看以下步骤

a。将列添加到原始表中,即your_table

b。从your_table中使用Select(列的顺序)到table_test中(可选)由anycol命令

c。放弃原始表格,即your_table

d。根据您的原始表名重命名您的新表,即table_test。







选择是你的。




希望这会对你有所帮助。





干杯
Hi,

There is no issue if you will add columns in last, all you have to make changes in your select statement.

Anyway if you still want to do it, you can do it as mentioned below.

1. using SQL Server Management Studio

2. you can also check below steps
a. add column to your original table i.e. your_table
b. make use of Select (order of your columns) into table_test from your_table (optional) Order by anycol
c. drop your original table i.e. your_table
d. Rename your new table i.e. table_test as per your original table name.



Choice is yours.


Hope this will help you.


Cheers