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 2008 Forums
 Transact-SQL (2008)
 How to call a DT file from Batch

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2011-07-27 : 21:40:02
I have a dts file located at C:\MyJobs\calcPctRpt.DTS

When i use DTSRUN c:\MyJobs\calcPctRpt.DTS

via Batch program, i am getting an error saying file not found.

What is the right way to call a dts file thru a batch (.bat)

Thank you very much for the helpful info.

lappin
Posting Yak Master

182 Posts

Posted - 2011-08-02 : 10:36:25
Here is a procedure you can use - not very secure because the password is hardcoded
Once created you can create a SQL job to run a legacy DTS.


CREATE procedure [dbo].[s_RunDTS] @DTSName as varchar (250)
AS
DECLARE @cmd as varchar (1000)
SELECT @cmd = 'dtsrun /S "(local)" /U myUser /P myPassword /N "' + @DTSName + '"'

EXEC master..xp_cmdshell @cmd
Go to Top of Page
   

- Advertisement -