Solved

Can I pass stored procedure name as global variable in DTS package?

Posted on 2004-08-26
2
463 Views
Last Modified: 2006-11-17
Hi,

I have few stored procedures which are receiving the same input parameters(2 input parameters). May I know whether I can pass the stored procedure name as a global variable to my DTS package?

I tried to put the SQL statement as "EXEC ? ?, ?", where the first question mark is my stored procedure name, 2nd and 3rd question marks are the 2 input parameters. And I got "Syntax error or access violation" when I clicked on Parameter button.

Could you please advise?

Thank you very much!



-HL
0
Comment
Question by:hllim
2 Comments
 
LVL 17

Accepted Solution

by:
BillAn1 earned 100 total points
ID: 11900560
I think what you will need to do is have a small stored procedure which takes 3 parameters and generates a dynamic SQL string from these and executes it e.g.

create procedure dynamic_proc (@sp_name varchar(100), @param1 int, @param2 int)
as
begin
declare @MySQL varchar(200)
set @MySQL = @sp_name + ' ' + @param1 + ',' + @param2
exec (@MySQL)
end

then your DTS SQLstatement can be
dynamic_proc ?,?,?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 11903436
In DTS, you can play around with the dynamic properties, this will allow you to do what you want...
Unfortunately, i don't have the software here to check it out. Learing by dogin ...
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes some very basic things about SQL Server filegroups.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question