Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8381767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:46:07+00:00 2026-06-09T16:46:07+00:00

This script was generated from SQL Server Management Studio. Why am I getting this

  • 0

This script was generated from SQL Server Management Studio. Why am I getting this error and how can I fix the ALTER script? Note, that I changed the word “CREATE” to “ALTER”. So I’m guessing the CREATE syntax is slightly different from the ALTER syntax, or has less restrictions. I’m using SQL Server 2008 Express. I see it’s telling me to end with a semicolon, but I want to make sure terminating the statement won’t cause me any issues later. If you can describe what each piece of the query does and what we’re changing, bonus points awarded.

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

Error:

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 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:46:08+00:00Added an answer on June 9, 2026 at 4:46 pm

    ALTER TABLE and CREATE TABLE are two totally different SQL statements that you cannot acheive by simply replacing CREATE with ALTER, so the way you generated your ALTER is wrong, what you can do is

    1. you can simply generate the ALTER script using the Change Script option available in SSMS every time when you change any Table or db object.
    2. Alternatively you can generate Alter scripts using VS2010(google for it as I am not gonna write this here) or any third party script generator, easily available on internet

    Additionally, instead of posting SQL statements on SO for others to explain them for you, give sometime to SQL learning (at least using SQL books online, installed with SQL server).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When executing scripts in SQL Server Management Studio, messages are often generated that display
This is from a sql script. What tool can generate this? Thanks --USE [MY_TABLE]
This error is really strange (SQL Server 2008 R2 (RTM). I am SELECTing from
The stored procedure scripts that SQL Server Management Studio 2005 generates for me are
Is it possible to generated ALTER sql script from the changes you perform in
I am generating a Sqlite from Sql Server, to do this I first run
When generating code/scripts, why does SQL Server Management Studio generate code using square brackets
I have an ASP.NET GridView which is populated from a SQL Server database. This
I use the SQL script that was generated (sql 2k5), to add a column
I am using SQL Server 2008 Enterprise. I am using Management Studio -> Jobs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.