Msg 102, Level 15, State 1, Line 2 Incorrect syntax near '‘'.

  • Hi,

    I was executing following SQL Batch ,

    "

    Use FlexFamilyMembership

    EXEC sp_resetstatus (‘FlexFamilyMembership’)

    ALTER DATABASE FlexFamilyMembership SET EMERGENCY

    DBCC checkdb (‘FlexFamilyMembership’)

    ALTER DATABASE FlexFamilyMembership SET SINGLE_USER WITH ROLLBACK IMMEDIATE

    DBCC CheckDB (‘FlexFamilyMembership’), (REPAIR_ALLOW_DATA_LOSS)

    ALTER DATABASE FlexFamilyMembership SET MULTI_USER

    "

    This cant executed giving error;

    Msg 102, Level 15, State 1, Line 2 Incorrect syntax near '‘'.

    Please give solution

  • The problem is with the single-quoted parameters. Use PRINT @sqlcommand instead of EXEC(@sqlcommand) and examine the statement.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

  • you should execute in this way :

    Use FlexFamilyMembership

    EXEC sp_resetstatus 'FlexFamilyMembership'

    ALTER DATABASE FlexFamilyMembership SET EMERGENCY

    DBCC checkdb ('FlexFamilyMembership')

    ALTER DATABASE FlexFamilyMembership SET SINGLE_USER WITH ROLLBACK IMMEDIATE

    DBCC CheckDB ('FlexFamilyMembership',REPAIR_ALLOW_DATA_LOSS)

    ALTER DATABASE FlexFamilyMembership SET MULTI_USER

  • najeeb_kt2000 (7/10/2012)


    DBCC CheckDB (‘FlexFamilyMembership’), (REPAIR_ALLOW_DATA_LOSS)

    Wait... what???

    Yo do realise that is going to cause data loss? No backups? No alternatives to throwing data away?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • This Sql give error

    Msg 102, Level 15, State 1, Line 2 ,Incorrect syntax near '‘'.

    why this problem.

  • Print instead of exec giving the error as follows'

    Msg 102, Level 15, State 1, Line 2,

    Incorrect syntax near '‘'.

    Msg 102, Level 15, State 1, Line 6

    Incorrect syntax near '‘'.

    Msg 102, Level 15, State 1, Line 10

    Incorrect syntax near '‘'.

    Msg 1038, Level 15, State 4, Line 12

    An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Add a name or single space as the alias name.

    Msg 105, Level 15, State 1, Line 13

    Unclosed quotation mark after the character string ''.

  • najeeb_kt2000 (7/10/2012)


    This Sql give error

    Msg 102, Level 15, State 1, Line 2 ,Incorrect syntax near '‘'.

    why this problem.

    Please respond to Gail's post before we continue with correcting the syntax error.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply