3
Answers

Error in Sql server query

Prabu Spark

Prabu Spark

11y
938
1
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)