Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 t-sql alter problem
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jassie
Constraint Violating Yak Guru

332 Posts

Posted - 02/05/2013 :  11:06:52  Show Profile  Reply with Quote
I am getting the following error on a sql server 2008 r2 database:

Msg 102, Level 15, State 1, Line 2

Incorrect syntax near '('.

Msg 319, Level 15, State 1, Line 17

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.

Can you tell me what is wrong with the following sql:

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

ALTER TABLE [dbo].[eRPT_Transaction_Tracking](
[eRpt_Tracking_ID] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
[Package_ID] [varchar](50) NOT NULL,
[Received_Date] [datetime] NULL,
[Download_Date] [datetime] NULL,

CONSTRAINT [PK_eRpt_Package] PRIMARY KEY CLUSTERED
(
[eRpt_Tracking_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]

GO

SET ANSI_PADDING OFF
GO

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 02/05/2013 :  11:16:55  Show Profile  Reply with Quote
you cant alter table like this

it should be

ALTER TABLE... ADD

see

http://msdn.microsoft.com/en-in/library/ms190273.aspx



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Edited by - visakh16 on 02/05/2013 11:17:54
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.28 seconds. Powered By: Snitz Forums 2000