开发者

How to add one column into existing SQL Table

I have a SQL Server table and it is located on a remote server. I can connect to it with SQL Server Management Studio but opening it takes time instead, I am doing my j开发者_StackOverflow中文版obs with SQL Query window without reaching it.

Recently I've made a change on the local copy of this table and want to update the remote one as well. All I've done is adding one more column which is Nullable and I'd like to learn how to add this one more column to the remote SQL Server with T-SQL without ruining the remote one data.

Here is the additional info:

Table Name: Products

Columns to be added: LastUpdate, Nullable and varchar(200)

Thanks.


The syntax you need is

ALTER TABLE Products ADD LastUpdate  varchar(200) NULL

This is a metadata only operation


What about something like:

Alter Table Products
Add LastUpdate varchar(200) null

Do you need something more complex than this?


Its work perfectly

ALTER TABLE `products` ADD `LastUpdate` varchar(200) NULL;

But if you want more precise in table then you can try AFTER.

ALTER TABLE `products` ADD `LastUpdate` varchar(200) NULL AFTER `column_name`;

It will add LastUpdate column after specified column name (column_name).


alter table table_name add field_name (size);

alter table arnicsc add place number(10);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜