6 个解决方案
#1
alter
#2
alter table
#3
right
#4
增加一个新的字段?
下面的代码从MSSQLServer中取得的完整代码,使用了事务处理,实现的功能是:将表tablename增加一个名称为newfield的字段
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.tablename ADD //这儿是关键性代码
newfiled char(10) NULL
GO
COMMIT
下面的代码从MSSQLServer中取得的完整代码,使用了事务处理,实现的功能是:将表tablename增加一个名称为newfield的字段
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.tablename ADD //这儿是关键性代码
newfiled char(10) NULL
GO
COMMIT
#5
oracle:
alter table tablename add (fieldname datatype)
alter table tablename add (fieldname datatype)
#6
sql server
alter table mytable add fieldname fieldtype [identity(1,1) not null]
放括号为可选
alter table mytable add fieldname fieldtype [identity(1,1) not null]
放括号为可选
#1
alter
#2
alter table
#3
right
#4
增加一个新的字段?
下面的代码从MSSQLServer中取得的完整代码,使用了事务处理,实现的功能是:将表tablename增加一个名称为newfield的字段
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.tablename ADD //这儿是关键性代码
newfiled char(10) NULL
GO
COMMIT
下面的代码从MSSQLServer中取得的完整代码,使用了事务处理,实现的功能是:将表tablename增加一个名称为newfield的字段
BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
ALTER TABLE dbo.tablename ADD //这儿是关键性代码
newfiled char(10) NULL
GO
COMMIT
#5
oracle:
alter table tablename add (fieldname datatype)
alter table tablename add (fieldname datatype)
#6
sql server
alter table mytable add fieldname fieldtype [identity(1,1) not null]
放括号为可选
alter table mytable add fieldname fieldtype [identity(1,1) not null]
放括号为可选