dbTalk Databases Forums  

More Help Needed on DTS & Stored Procedures

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss More Help Needed on DTS & Stored Procedures in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peter Newman
 
Posts: n/a

Default More Help Needed on DTS & Stored Procedures - 02-13-2004 , 02:46 AM






I was given advice earlier this week regarding how to
assign a returning value from a Stored Procedure into a
Global Varaible from a Execute SQL Task. I must be
missing the point as i still can not get it to work. The
only parameter it is allowing is an input Parameter.

Stored Proc

CREATE PROCEDURE UpdateHeaders
@RtnVal Integer Output,
@Licence Varchar(6),
@ModifiedDate Varchar(10),
@Serial Varchar(3),
@Volume Varchar(6),
@Status Varchar(1),
@Type Varchar(1),
@Action Varchar(1)
AS
.......

ExecuteSQlTask :

EXEC
UpdateHeaders '217353','21/01/2004','009','000000','Unsubm
itted','Live','A', ? OUTPUT
or
EXEC ? =
UpdateHeaders '217353','21/01/2004','009','000000','Unsubm
itted','Live','A'

neither of which produce an output parameter. can any one
help show me where ive gone wrong, or point me in the
directon on some info on this

Thanks

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: More Help Needed on DTS & Stored Procedures - 02-13-2004 , 03:20 AM






? expects you to be passing IN values not retrieving

so you may want to redo this to

Declare @out int
EXEC UpdateHeaders
'217353','21/01/2004','009','000000','Unsubmitted','Live','A', @out OUTPUT
SELECT @out as OutputValue

You should now be able to map this to an output parameter.



--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peter Newman" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
I was given advice earlier this week regarding how to
assign a returning value from a Stored Procedure into a
Global Varaible from a Execute SQL Task. I must be
missing the point as i still can not get it to work. The
only parameter it is allowing is an input Parameter.

Stored Proc

CREATE PROCEDURE UpdateHeaders
@RtnVal Integer Output,
@Licence Varchar(6),
@ModifiedDate Varchar(10),
@Serial Varchar(3),
@Volume Varchar(6),
@Status Varchar(1),
@Type Varchar(1),
@Action Varchar(1)
AS
......

ExecuteSQlTask :

EXEC
UpdateHeaders '217353','21/01/2004','009','000000','Unsubm
itted','Live','A', ? OUTPUT
or
EXEC ? =
UpdateHeaders '217353','21/01/2004','009','000000','Unsubm
itted','Live','A'

neither of which produce an output parameter. can any one
help show me where ive gone wrong, or point me in the
directon on some info on this

Thanks



Reply With Quote
  #3  
Old   
Peter
 
Posts: n/a

Default Re: More Help Needed on DTS & Stored Procedures - 02-13-2004 , 08:51 AM



Alle

Thanks again. I can see where i was going wrong.. and surprise surprise it work

again a big thank you

Reply With Quote
  #4  
Old   
Peter Newman
 
Posts: n/a

Default RE: More Help Needed on DTS & Stored Procedures - 02-13-2004 , 09:36 AM



Allen
currently im using an Active x task to build the EXEC Updateheaders sql for the executeSQl task.. I was wondering that if i can use global varables values then i could do away with one of the task

your code example ( which works )
Declare @out in
EXEC UpdateHeaders '217353','21/01/2004','009','000000','Unsubmitted','Live','A', @out OUTPUT
SELECT @out as OutputValu

Now if '217353' is stored in a Global Varaible sLicence , could i use the imput parameter of the executesqltask, and if so how to declare it in the query?

Reply With Quote
  #5  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: More Help Needed on DTS & Stored Procedures - 02-13-2004 , 10:44 AM



So you want to use IN and OUTPUT parameters.

Have a read of this article we wrote for dealing with this

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/Default.aspx?234)


We basically fool designer at design time because we know the runtime parser
is more robust



--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peter Newman" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Allen,
currently im using an Active x task to build the EXEC Updateheaders sql
for the executeSQl task.. I was wondering that if i can use global varables
values then i could do away with one of the tasks
Quote:
your code example ( which works )
Declare @out int
EXEC UpdateHeaders
'217353','21/01/2004','009','000000','Unsubmitted','Live','A', @out OUTPUT
SELECT @out as OutputValue

Now if '217353' is stored in a Global Varaible sLicence , could i use the
imput parameter of the executesqltask, and if so how to declare it in the
query?




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.