January 18, 2007 at 6:07 pm
Hi I am trying to create a back up job (as part of my log shipping solution) using SQL Safe back up... My sql in the job is returning a syntax error and I cannot figure it out. Please help me identify the problem. See code below my comments.
Also, anyone with SQL Safe experience? I have a seperate thread going please stop by and share your experience.
Log Shipping your expertise, I am currently testing or custom log shipping vs. Microsoft's out the box solution. Any comments, experiences and advice is greatly appreciated. Also on its own thread.
DECLARE @lvDBName varchar
(101)
-- Enter DBName Below
SET @lvDBName
= 'MyDB'
DECLARE @lvSQLServerName varchar
(101)
DECLARE @lvNTServerName varchar
(101)
IF
charindex (@@servername, '\') = 0
BEGIN
SET @lvSQLServerName
= @@ServerName
SET @lvNTServerName
= @@ServerName
END
ELSE
BEGIN
SET @lvSQLServerName
= replace (@@servername, '\', '-')
SET @lvNTServerName
= substring(@@servername, 1, charindex('\', @@servername) -1 )
END
--the error is below
EXEC
("master..xp_ss_backup "+@lvDBName+"
TO DISK = '\\"
+@lvNTServerName+"\Backup$\"+@lvDBName+"\"+@lvSQLServerName+"_"+@lvDBName+"_DBBackup.BAK
WITH DESCRIPTION = 'Database',
INIT,
STATS = 10"
)
Thanks In Advance,
Aurora
Aurora
January 18, 2007 at 11:05 pm
When you are using doubel quotes you have to SET QUOTED_IDENTIFIER OFF....
set quoted_identifier off
select ("master..xp_ss_backup "+@lvDBName+" TO DISK = '\\"+@lvNTServerName+"\Backup$\"+@lvDBName+"\"+@lvSQLServerName+"_"+@lvDBName+"_DBBackup.BAK WITH DESCRIPTION = 'Database', INIT, STATS = 10")
MohammedU
Microsoft SQL Server MVP
January 19, 2007 at 7:23 am
I knew it was something so simple! That worked, thanks!
Aurora
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply