此脚本是从SQL Server Management Studio生成的。为什么我得到这个错误,我该如何解决ALTER脚本?请注意,我将单词“CREATE”更改为“ALTER”。所以我猜CREATE语法与ALTER语法略有不同,或者有更少的限制。我正在使用SQL Server 2008 Express。我看到它告诉我以分号结束,但我想确保终止该声明以后不会引起任何问题。如果您可以描述查询的每一部分以及我们正在更改的内容,则会奖励奖励积分。T-SQL:对ALTER TABLE脚本崩溃修改CREATE TABLE脚本
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--CREATE TABLE [dbo].[defect](
ALTER TABLE [dbo].[defect](
[defect_id] [bigint] IDENTITY(1,1) NOT NULL,
[defect_number] [nvarchar](50) NULL,
[defect_type] [nvarchar](50) NULL,
[date_created] [datetime] NULL,
[user_identified_by] [nvarchar](50) NULL,
[status] [nvarchar](50) NULL,
[date_modified] [datetime] NULL,
[user_qa] [nvarchar](50) NULL,
[severity] [nvarchar](50) NULL,
[environment] [nvarchar](50) NULL,
[user_assigned] [nvarchar](50) NULL,
[project] [nvarchar](50) NULL,
[target_table_affected] [nvarchar](50) NULL,
[required_for_go_live] [nvarchar](50) NULL,
[project_phase] [nvarchar](50) NULL,
[completion_hours] [nvarchar](50) NULL,
[date_migrate_prod] [datetime] NULL,
[description] [text] NULL,
[table_columns_affected] [text] NULL,
[sample_data] [text] NULL,
[action_taken] [text] NULL,
[supp_detail_links] [text] NULL,
[supp_detail_links_dtml] [text] NULL,
[thread] [bigint] NULL,
CONSTRAINT [PK_defect] PRIMARY KEY CLUSTERED
(
[defect_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
错误:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '('.
Msg 319, Level 15, State 1, Line 29
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.
+1仅用于在线推荐图书。 – MatBailie 2012-08-16 07:56:21
我很惊讶,我的问题得到了-2,但我为它赢得了“热门问题”徽章。 – MacGyver 2013-03-13 17:09:03