如何修改表sql server? [英] how to modify in a table sql server?

查看:129
本文介绍了如何修改表sql server?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生



我尝试在表格字段中修改数据库时多次尝试所以它显示错误不允许添加任何字段,就像我忘了两个字段在我的客户表中



价格和销售日期然后当我尝试在任何测试条目之后再次添加因此它始终显示错误

Dear Sir

I Tried many times when i try to modify in database in table field so it shows error not allowed to add any field like i forgot two field in my a customer table

Price and sale date then when i try to add again after any test entry so it shows always error

推荐答案

请参阅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。







选择是你的。< br $>




希望这会对你有所帮助。





干杯
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


这篇关于如何修改表sql server?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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