如何向现有表中添加列? [英] How can I add a column to an existing table?

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

问题描述

如何更改 SQL Server Compact Edition (SQL CE) 中的表?

How can I alter a table in SQL Server Compact Edition (SQL CE)?

我有一个现有表,我需要添加一个 IDENTITY 列.

I have an existing table, and I need to add an IDENTITY column.

推荐答案

添加列的方式与在其他版本的 SQL Server 中添加列的方式相同:

You add a column in the same way you would add it in other versions of SQL Server:

这将一个名为 IdColumnName 的主键标识列添加到表 tableName:

This adds a primary key identity column called IdColumnName to the table tableName:

ALTER TABLE tableName
ADD COLUMN IdColumnName INTEGER IDENTITY (1,1) PRIMARY KEY

请参阅ALTER TABLE 语法适用于 SQL Server 精简版.

See the ALTER TABLE syntax for SQL Server compact edition.

这篇关于如何向现有表中添加列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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