Incorrect syntax near 'QUOTED_IDENTIFI'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nathalie
    New Member
    • Apr 2013
    • 4

    Incorrect syntax near 'QUOTED_IDENTIFI'

    hi,
    i am an external sql script that i called using sqlcmd from command prompt. However, an error appeared, "Msg 102, Level 15, State 1, Server db\SQLEXPRESS, Line 2
    Incorrect syntax near 'QUOTED_IDENTIF I'."

    Is there any software that i can use to validate the sql script ? i need more clear error description.

    Code:
    --[START EXPORT FILE : First line of script file]
    SET NOCOUNT ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET IDENTITY_INSERT tbl_test ON
    GO
    ALTER TABLE tbl_test NOCHECK CONSTRAINT ALL
    ...
    ALTER TABLE tbl_test CHECK CONSTRAINT ALL
    GO
    SET IDENTITY_tbl_test OFF
    SET QUOTED_IDENTIFIER OFF
    GO
    
    SET NOCOUNT OFF
    --[COMPLETE EXPORT FILE: Last line of script file]
    Last edited by acoder; Apr 22 '13, 11:03 AM. Reason: Please use [code] tags when posting code
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    And the SQL runs fine elsewhere?

    The reason I ask is because line 12 looks wrong. I assume line 9 is just you collapsing the rest of the code.

    Comment

    • nathalie
      New Member
      • Apr 2013
      • 4

      #3
      incorrect syntax near 'quoted_identif i'

      Yes, the SQL runs without errors in MS SQL mgmt studio.
      Line 9 is hidden as i am collapsing the rest of the code which are all INSERT statements.

      Is line 12 wrong, what should be the correct answer?

      Any good tool to recommend?


      Originally posted by Rabbit
      And the SQL runs fine elsewhere?

      The reason I ask is because line 12 looks wrong. I assume line 9 is just you collapsing the rest of the code.

      Comment

      • nathalie
        New Member
        • Apr 2013
        • 4

        #4
        oh.. line 12 should be, it's my typo error in the 1st msg
        SET IDENTITY_INSERT tbl_test OFF

        Comment

        • Rabbit
          Recognized Expert MVP
          • Jan 2007
          • 12517

          #5
          Compare the equivalent on line 6 to line 12.

          Comment

          • nathalie
            New Member
            • Apr 2013
            • 4

            #6
            Code:
            --[START EXPORT FILE : First line of script file]
            SET NOCOUNT ON
            GO
            SET QUOTED_IDENTIFIER ON
            GO
            SET IDENTITY_INSERT tbl_test ON
            GO
            ALTER TABLE tbl_test NOCHECK CONSTRAINT ALL
            ...
            ALTER TABLE tbl_test CHECK CONSTRAINT ALL
            GO
            SET IDENTITY_INSERT tbl_test OFF
            SET QUOTED_IDENTIFIER OFF
            GO
             
            SET NOCOUNT OFF
            --[COMPLETE EXPORT FILE: Last line of script file]
            Other than Line 12, is there any other "incorrect" areas? coz line 12 is an error when i copied and paste to this textbox, i accidentally removed the word '_INSERT'.

            or maybe i can send u my file and u can see exactly what i have? what's ur email address?

            Comment

            • Rabbit
              Recognized Expert MVP
              • Jan 2007
              • 12517

              #7
              We prefer that you post the code in the thread itself.

              Comment

              Working...