locked
sql02010: Incorrect syntax near ,. RRS feed

  • Question

  • I have that errror message "sql02010: Incorrect syntax near ,." almost at 60 different places. I tried to right click and do the SQLCMD mode but the error doesnt seem to go away.

    Here is the code:

    ALTER TABLE [dbo].[PostageRatesWithEffDates]

        ADD CONSTRAINT [PostageRatesWithEffDates_PK] PRIMARY KEY CLUSTERED (/*[EffectiveDateBeg] ASC*/, /*[EffectiveDateEnd] ASC*/, /*[PostageRateID] ASC*/) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);

    Thursday, August 16, 2012 4:47 PM

Answers

  • Why are all column name in comments /* */? You have to add at least one (un-commented) column name.

    Olaf Helper
    Blog Xing

    Thursday, August 16, 2012 4:50 PM
  • HI Silver !

    As Olaf already mentioned you might be using something similar to below query;

    ALTER TABLE [dbo].[PostageRatesWithEffDates]
    ADD CONSTRAINT [PostageRatesWithEffDates_PK] PRIMARY KEY CLUSTERED ([EffectiveDateBeg] ASC, [EffectiveDateEnd] ASC, [PostageRateID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);



    Please let me know if this helps. Hopefully i have answered you correctly.

    Thanks, Hasham Niaz

    • Marked as answer by SilverShadow30 Thursday, August 16, 2012 5:09 PM
    Thursday, August 16, 2012 5:03 PM
    Answerer

All replies

  • Why are all column name in comments /* */? You have to add at least one (un-commented) column name.

    Olaf Helper
    Blog Xing

    Thursday, August 16, 2012 4:50 PM
  • ok. I'll check on that. thanks
    Thursday, August 16, 2012 4:54 PM
  • HI Silver !

    As Olaf already mentioned you might be using something similar to below query;

    ALTER TABLE [dbo].[PostageRatesWithEffDates]
    ADD CONSTRAINT [PostageRatesWithEffDates_PK] PRIMARY KEY CLUSTERED ([EffectiveDateBeg] ASC, [EffectiveDateEnd] ASC, [PostageRateID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);



    Please let me know if this helps. Hopefully i have answered you correctly.

    Thanks, Hasham Niaz

    • Marked as answer by SilverShadow30 Thursday, August 16, 2012 5:09 PM
    Thursday, August 16, 2012 5:03 PM
    Answerer
  • yup. that worked. Thank you!
    Thursday, August 16, 2012 5:10 PM