|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Stored Procedure to execute DTS Packages
Hi, hoping someone may be able to shed some light on this.
I have a stored procedure that conditionally executes different DTS Packages. Everything seems to work, there's no errors at all, but the DTS Packages are never executed. Wondering if anyone has any ideas. Here's the stored procedure.... CREATE PROCEDURE exportLists AS DECLARE @script VARCHAR(8000) DECLARE @id INT DECLARE @max INT select regionid,count(distinct homephone) as phone into #phone from tbl_template Where exportid is null group by regionid select officeid,listpath into #office from tbl_office WHERE startdate <= GETDATE() AND (enddate >= GETDATE() OR enddate IS NULL) and listpath is not null and listpath <> '' Select case when phone > 2500 then '"exportLists" /A MDBFile="' + listpath + '" /A OfficeID ="' + convert(varchar(10),officeid) + '" ' Else '"resetTemplate" /A OfficeID="' + convert(varchar(10),officeid) + '" ' end as cmd ,Identity(int,1,1) as rowno ,phone into #temp from #office as O inner Join #phone as p on o.officeid=p.regionid Set @max=@@rowcount set @id = 1 While @id <=@max Begin Select @script='"Dtsrun /S "' + @@SERVERNAME + '" /E /N ' + cmd + case when phone > 2500 then '/A ExportID="' + convert(varchar(10),(Select coalesce(Max(listid),0) + 1 from tbl_sf3Lists)) + '" ' else ' ' end , @id=@id+1 from #temp Where rowno = @id End Return GO |
|
#2
|
|||
|
|||
|
You are missing a call to xp_cmdshell to execute your dtsrun command.
tim |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Stored Procedure to execute DTS Packages |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|