Solved

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

Posted on 2004-08-26
2
458 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 142

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Read about achieving the basic levels of HRIS security in the workplace.
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now