Prabu Spark

Prabu Spark

  • NA
  • 124
  • 203.5k

Error in Sql server query

Aug 21 2013 2:28 AM
Hi sir,
      I am getting the error

 "Msg 102, Level 15, State 1, Line 3
Incorrect syntax near '+'.
Msg 319, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon." after executing the below query. Kindly give me the solution for this problem




Query:
----------------

declare @backuptime varchar(50)
set @backuptime=convert(varchar,getdate())
BACKUP DATABASE checking TO DISK = 'd:\testdb1_'+@backuptime+'.bak' WITH FORMAT,    MEDIANAME = 'checking',    NAME = 'Full backup of my database';
GO




Answers (3)