locked
sql syntax error Incorrect syntax near 'N'. RRS feed

  • Question

  • RESTORE DATABASE [cpsdyn] FROM DISK = N’C:\CSBackup\cpsdyn.bak’ WITH FILE = 1,

    MOVE N’cpsdyn_data’ TO N’C:\CsData\ApplicationStore\(default)\dbpath\cpsdyn.mdf’,

    MOVE N’cpsdyn_log’ TO N’C:\CsData\ApplicationStore\(default)\dbpath\CPSDYN.LDF’,

    NOUNLOAD, REPLACE, STATS = 10

    GO

    Msg 102, Level 15, State 1, Line 1

    Incorrect syntax near 'N'.

    Msg 319, Level 15, State 1, Line 1

    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.

    Msg 132, Level 15, State 1, Line 2

    The label 'C' has already been declared. Label names must be unique within a query batch or stored procedure.

    Msg 132, Level 15, State 1, Line 3

    The label 'C' has already been declared. Label names must be unique within a query batch or stored procedure.

    Thursday, October 16, 2014 11:43 PM

Answers

  • Hi

    Please see the screen shoot below, the issue is with your single quote(') you have user as (’)

    please modify your script with single quote(') and check

    Thanks

    Saravana Kumar C

    • Proposed as answer by Olaf HelperMVP Friday, October 17, 2014 6:38 AM
    • Marked as answer by totalnet32 Friday, October 17, 2014 3:07 PM
    Friday, October 17, 2014 12:17 AM