dbTalk Databases Forums  

Need Example exec proc from VBScript ActiveX DTS.

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


Discuss Need Example exec proc from VBScript ActiveX DTS. in the microsoft.public.sqlserver.dts forum.



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

Default Need Example exec proc from VBScript ActiveX DTS. - 05-10-2005 , 09:58 AM






I need to exec a stored proc with one int input param, one int output param,
and a Return int from within an ActiveX VBScript. I have been working on this
for two days and am stumped using an ADO connection. Can't find much on MSDN
for VBScript.

Thanks,

Michael

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

Default Re: Need Example exec proc from VBScript ActiveX DTS. - 05-10-2005 , 02:56 PM






Can you not use an ExecuteSQL task?

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




"Snake" <Snake (AT) discussions (DOT) microsoft.com> wrote


Quote:
I need to exec a stored proc with one int input param, one int output param,
and a Return int from within an ActiveX VBScript. I have been working on this
for two days and am stumped using an ADO connection. Can't find much on MSDN
for VBScript.

Thanks,

Michael


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

Default Re: Need Example exec proc from VBScript ActiveX DTS. - 05-10-2005 , 04:16 PM



No, I need to integrate global variables in and out of several DTS steps.

"Allan Mitchell" wrote:

Quote:
Can you not use an ExecuteSQL task?

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




"Snake" <Snake (AT) discussions (DOT) microsoft.com> wrote in message
news:Snake (AT) discussions (DOT) microsoft.com:

I need to exec a stored proc with one int input param, one int output param,
and a Return int from within an ActiveX VBScript. I have been working on this
for two days and am stumped using an ADO connection. Can't find much on MSDN
for VBScript.

Thanks,

Michael



Reply With Quote
  #4  
Old   
Darren Green
 
Posts: n/a

Default Re: Need Example exec proc from VBScript ActiveX DTS. - 05-10-2005 , 05:22 PM



In message <D3508300-6CAD-4544-8722-124A74459DB3 (AT) microsoft (DOT) com>, Snake
<Snake (AT) discussions (DOT) microsoft.com> writes
Quote:
No, I need to integrate global variables in and out of several DTS steps.

"Allan Mitchell" wrote:

Can you not use an ExecuteSQL task?

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

That doesn't mean you cannot use the Exec SQL Task, it supports using
global variables for input and output.

If you insist on using ADO, then look at the ADO Command object, and the
parameters collection.

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
  #5  
Old   
Helge C. Rutz
 
Posts: n/a

Default Re: Need Example exec proc from VBScript ActiveX DTS. - 05-10-2005 , 06:32 PM



Hi Snake,

"Snake" <Snake (AT) discussions (DOT) microsoft.com> schrieb im Newsbeitrag
news3508300-6CAD-4544-8722-124A74459DB3 (AT) microsoft (DOT) com...
Quote:
No, I need to integrate global variables in and out of several DTS steps.

"Allan Mitchell" wrote:

Can you not use an ExecuteSQL task?

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)
I'm afraid Allans idea is not the worst.
AFAIK ADO doesn't support output parameters of stored procs nativly.
So the only way to get them is to execute a batch which collects them and
return them as one SELECT statement to build a recordset.
But thats exactly what you can do within a ExecuteSQLTask, where you can
pass this result to a global rowset variable.

And if you have problems passing the parameters to the sql statements, you
may think about dynamicly rewriting the sql statements with an AciveX task.
E.G. I created a package where the sql statements contained placeholders
for the variables and an ActiveX task cycled through all sql tasks of the
package and replaced them with the variable values.

Helge




Reply With Quote
  #6  
Old   
Snake
 
Posts: n/a

Default Re: Need Example exec proc from VBScript ActiveX DTS. - 05-11-2005 , 11:36 AM



Helge,
Thanks a lot! Your explanation is textbook quality. Those of us learning
this stuff appreciate the extra effort.

I saw an MSDN ADO coding example in VB and thought that it could be
modified into VBscript but was apparently wrong.

Best regards,
Michael

"Helge C. Rutz" wrote:

Quote:
Hi Snake,

"Snake" <Snake (AT) discussions (DOT) microsoft.com> schrieb im Newsbeitrag
news3508300-6CAD-4544-8722-124A74459DB3 (AT) microsoft (DOT) com...
No, I need to integrate global variables in and out of several DTS steps.

"Allan Mitchell" wrote:

Can you not use an ExecuteSQL task?

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

I'm afraid Allans idea is not the worst.
AFAIK ADO doesn't support output parameters of stored procs nativly.
So the only way to get them is to execute a batch which collects them and
return them as one SELECT statement to build a recordset.
But thats exactly what you can do within a ExecuteSQLTask, where you can
pass this result to a global rowset variable.

And if you have problems passing the parameters to the sql statements, you
may think about dynamicly rewriting the sql statements with an AciveX task.
E.G. I created a package where the sql statements contained placeholders
for the variables and an ActiveX task cycled through all sql tasks of the
package and replaced them with the variable values.

Helge




Reply With Quote
  #7  
Old   
Snake
 
Posts: n/a

Default Re: Need Example exec proc from VBScript ActiveX DTS. - 05-13-2005 , 02:31 PM



I have just spent the last several hours trying to use ExecuteSQL task, and
have not been successful. As you know, the DTS designer is too stupid to
handle output variables correctly, so the DTSSQL article suggests a method to
fool DTS into creating the output variables using "metadata" spoofing. I am
sure it works for someone, but it does not seem to work for me. I am going to
have to go back to my boss and tell him he is out of luck.

So much for DTS!



"Darren Green" wrote:

Quote:
In message <D3508300-6CAD-4544-8722-124A74459DB3 (AT) microsoft (DOT) com>, Snake
Snake (AT) discussions (DOT) microsoft.com> writes
No, I need to integrate global variables in and out of several DTS steps.

"Allan Mitchell" wrote:

Can you not use an ExecuteSQL task?

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


That doesn't mean you cannot use the Exec SQL Task, it supports using
global variables for input and output.

If you insist on using ADO, then look at the ADO Command object, and the
parameters collection.

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
  #8  
Old   
Helge C. Rutz
 
Posts: n/a

Default Re: Need Example exec proc from VBScript ActiveX DTS. - 05-13-2005 , 02:58 PM



Hi Snake,

"Snake" <Snake (AT) discussions (DOT) microsoft.com> schrieb im Newsbeitrag
news:F04915AC-4A59-4ED3-BA2F-8B45B8F5D62A (AT) microsoft (DOT) com...
Quote:
I have just spent the last several hours trying to use ExecuteSQL task,
and
have not been successful. As you know, the DTS designer is too stupid to
handle output variables correctly, so the DTSSQL article suggests a
method to
fool DTS into creating the output variables using "metadata" spoofing. I
am
sure it works for someone, but it does not seem to work for me. I am
going to
have to go back to my boss and tell him he is out of luck.
I'm sorry to hear that, but I cannot completly understand it.
If you mean the problem to define input and output parameters for complex
statements/batches, yes thats ugly, but nothing you can't workaround.
Maybee you should post some code here to demonstrate and discuss.
I'm nearly sure there is a solution for your problem.
To don't let you out in the rain I would like to offer you to look over a
sample package to see if there is a way out.

Helge




Reply With Quote
  #9  
Old   
Snake
 
Posts: n/a

Default Re: Need Example exec proc from VBScript ActiveX DTS. - 05-13-2005 , 03:43 PM



Helge,

Here is the Spoof:
select PropertyId as PropertyImportId
from propertyparcel where propertyid = ? and propertyparcelId = ?

Here is the target code:
DECLARE @PropertyImportId int
EXEC @Retstat = dbo.DeedsImport ?, ?, @PropertyImportId output
SELECT @PropertyImportId as PropertyImportId

Here is the proc defn:
CREATE PROCEDURE DeedsImport @@VendorId int = 1,
@@FileName Varchar(50),
@@PropertyImportId int OUTPUT
AS
SET NOCOUNT ON
..
..


Here is the table from the spoof:
CREATE TABLE [PropertyParcel] (
[PropertyParcelID] [int] IDENTITY (1, 1) NOT NULL ,
[CreationDate] [smalldatetime] NOT NULL CONSTRAINT
[DF_PropertyParcel_CreationDate] DEFAULT (getdate()),
[LastUpdated] [smalldatetime] NOT NULL CONSTRAINT
[DF_PropertyParcel_LastUpdated] DEFAULT (getdate()),
[PropertyID] [int] NOT NULL

I appreciate the help. I am at my wits-end!

Michael

"Helge C. Rutz" wrote:

Quote:
Hi Snake,

"Snake" <Snake (AT) discussions (DOT) microsoft.com> schrieb im Newsbeitrag
news:F04915AC-4A59-4ED3-BA2F-8B45B8F5D62A (AT) microsoft (DOT) com...
I have just spent the last several hours trying to use ExecuteSQL task,
and
have not been successful. As you know, the DTS designer is too stupid to
handle output variables correctly, so the DTSSQL article suggests a
method to
fool DTS into creating the output variables using "metadata" spoofing. I
am
sure it works for someone, but it does not seem to work for me. I am
going to
have to go back to my boss and tell him he is out of luck.

I'm sorry to hear that, but I cannot completly understand it.
If you mean the problem to define input and output parameters for complex
statements/batches, yes thats ugly, but nothing you can't workaround.
Maybee you should post some code here to demonstrate and discuss.
I'm nearly sure there is a solution for your problem.
To don't let you out in the rain I would like to offer you to look over a
sample package to see if there is a way out.

Helge




Reply With Quote
  #10  
Old   
Helge C. Rutz
 
Posts: n/a

Default Re: Need Example exec proc from VBScript ActiveX DTS. - 05-13-2005 , 04:44 PM



Did you saw my reply to the new threat?

Helge

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.