Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Need help on sql job/SQL dynamic sequel statement.

Author  Topic 

NguyenL71
Posting Yak Master

228 Posts

Posted - 2008-12-11 : 17:30:08
can't find what wrong with the step1 below. I create a job to run and select Type: TRansact-SQL Script using xp_cmdshell to execute the dynamic

sequel because but it does not work. Which is not return any messages back to the log file but when I change to select Operating system (CmdExec) is

working fine, message send back to the client and output to the log file. Is there anything wrong with the dynamic sequel statement below (step1).

Thank you in advance.

-- step 1. Not working.
-- Job name: Netbackup testing.

notes: SQL Agent runs under user domain account which is belong in local admin group.

-- Type: Transact-SQL Script (T-SQL)
DECLARE @SQLCmd VARCHAR(2000),
@Path VARCHAR(100)

SET @Path = 'H:\Backup\Productiondb_DIFF_DB.bak'
SET @SQLCmd = '"c:\program files\Veritas\NetBackup\bin\bpbackup" -p DB_DevServer -s DAILY_FULL -S CompDomain.test.dbc -t 13 -L C:\nbu_progress -k "Backup of LiteSpeed backups" ' + @Path

PRINT @SQLCmd

-- EXECUTE master.dbo.xp_cmdshell SQLCmd, NO_OUTPUT
GO
---------------------------------------------------------------------

--step2 is working fine. It working fine.

Type: Operating system (CmdExec)

"c:\program files\Veritas\NetBackup\bin\bpbackup" -p DB_DevServer -s DAILY_FULL -S CompDomain.test.dbc -t 13 -L C:\nbu_progress -k "Backup of LiteSpeed backups" H:\Backup\Productiondb_DIFF_DB.bak

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2008-12-12 : 10:05:13
try replacing 'H:\' with full path e.g '\\server\folder\'
Go to Top of Page
   

- Advertisement -