Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-08-26
2
Medium Priority
?
470 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 300 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
What we learned in Webroot's webinar on multi-vector protection.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

824 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