How do I drop a table column in SQL Server 2012? [closed]

坚强是说给别人听的谎言 提交于 2019-12-23 17:11:55

问题


I wish to drop a table column in SQL Server 2012, without affecting other columns in the table (and their data).

How can I do this? Is it possible at all?

So far I've tried deleting the column via SQL Server Management Studio, but this says the whole table must be dropped and re-created.


回答1:


From MSDN

ALTER TABLE dbo.Table DROP COLUMN column_b




回答2:


ALTER TABLE table_name
DROP COLUMN column_name



回答3:


To drop column

alter table tblname drop column colname

To add column

alter table tblname add colname datatype


来源:https://stackoverflow.com/questions/13491554/how-do-i-drop-a-table-column-in-sql-server-2012

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!