dbTalk Databases Forums  

Calling a SP from activeXscript

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


Discuss Calling a SP from activeXscript in the microsoft.public.sqlserver.dts forum.



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

Default Calling a SP from activeXscript - 10-15-2003 , 03:00 PM






I need to execute a stored procedure from an activeXscript
and I'm not sure about the syntax. Thanks in advance for
your help. Here is my code -

Function Main()

Dim objFSO, strFullNm
Set objFSO = CreateObject ("Scripting.FileSystemObject")

strFullNm = DTSGlobalVariables("gvFilePathRoot").Value &_
"\ebtr_bldg_prop.txt"

If objFSO.FileExists (strFullNm) Then

-- here is the SP that I need to exec
exec
master.dbo.xp_cmdshell 'dtsrun /SMyServer /Ujohn /Pjohn123
/Nmy_dts_pkg /Metl123'

MsgBox "The File Exists"
Else
MsgBox "You still need to create the file"
End If

Set objFSO = nothing

Main = DTSTaskExecResult_Success
End Function


Reply With Quote
  #2  
Old   
Ahmed
 
Posts: n/a

Default Calling a SP from activeXscript - 10-15-2003 , 03:29 PM






After creating the db connections, you

SQLQuery = "select * from table"
objConnection(0).CommandTimeout = 30
Set objRecordSet(0) = objConnection(0).Execute(SQLQuery)


Quote:
-----Original Message-----
I need to execute a stored procedure from an
activeXscript
and I'm not sure about the syntax. Thanks in advance for
your help. Here is my code -

Function Main()

Dim objFSO, strFullNm
Set objFSO = CreateObject ("Scripting.FileSystemObject")

strFullNm = DTSGlobalVariables("gvFilePathRoot").Value &_
"\ebtr_bldg_prop.txt"

If objFSO.FileExists (strFullNm) Then

-- here is the SP that I need to exec
exec
master.dbo.xp_cmdshell 'dtsrun /SMyServer /Ujohn /Pjohn123

/Nmy_dts_pkg /Metl123'

MsgBox "The File Exists"
Else
MsgBox "You still need to create the file"
End If

Set objFSO = nothing

Main = DTSTaskExecResult_Success
End Function

.


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

Default Re: Calling a SP from activeXscript - 10-16-2003 , 01:26 AM



You do not need to run a stored proc. You can simply shell out to the
cmdline to run DTSRUN.

Stored Proc: Why in an Active Script task ? You could simply check for the
file's existence and then use workflow to call an ExecuteSQL task (To use
the xp_cmdsheell stored proc).

Why do you need to have a seperate package ? You can simply use workflow to
check for the file and not proceed with the rest of the package if it does
not exist.

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Daizy" <silvah (AT) wellsfargo (DOT) com> wrote

Quote:
I need to execute a stored procedure from an activeXscript
and I'm not sure about the syntax. Thanks in advance for
your help. Here is my code -

Function Main()

Dim objFSO, strFullNm
Set objFSO = CreateObject ("Scripting.FileSystemObject")

strFullNm = DTSGlobalVariables("gvFilePathRoot").Value &_
"\ebtr_bldg_prop.txt"

If objFSO.FileExists (strFullNm) Then

-- here is the SP that I need to exec
exec
master.dbo.xp_cmdshell 'dtsrun /SMyServer /Ujohn /Pjohn123
/Nmy_dts_pkg /Metl123'

MsgBox "The File Exists"
Else
MsgBox "You still need to create the file"
End If

Set objFSO = nothing

Main = DTSTaskExecResult_Success
End Function




Reply With Quote
  #4  
Old   
tony ordner
 
Posts: n/a

Default Re: Calling a SP from activeXscript - 10-16-2003 , 03:19 PM



There is another thing to remember if you have a SP that runs for more than
1 or 2 minutes.. there is a command timeout setting you will need to set
higher. Here is how my connection is setup...

'Create a connection object
Set cn = CreateObject("ADODB.Connection")
'Connect using the OLE DB provider for SQL Server - SQLOLEDB
cn.Provider = "sqloledb"
cn.Properties("Data Source").Value = "computername.domain.com"
cn.Properties("Initial Catalog").Value = "COSY_STAGE"
cn.Properties("Integrated Security").Value = "SSPI"
cn.ConnectionTimeout = 0
cn.CommandTimeout = 0
cn.open
cn.sp_DTS_Load_COSy_Stage

Watch out for EXACT capitalization of the DTS name (sp_DTS_Load_COSy_Stage)
as it will cause it not to work.

Good luck
tonyo

"Daizy" <silvah (AT) wellsfargo (DOT) com> wrote

Quote:
I need to execute a stored procedure from an activeXscript
and I'm not sure about the syntax. Thanks in advance for
your help. Here is my code -

Function Main()

Dim objFSO, strFullNm
Set objFSO = CreateObject ("Scripting.FileSystemObject")

strFullNm = DTSGlobalVariables("gvFilePathRoot").Value &_
"\ebtr_bldg_prop.txt"

If objFSO.FileExists (strFullNm) Then

-- here is the SP that I need to exec
exec
master.dbo.xp_cmdshell 'dtsrun /SMyServer /Ujohn /Pjohn123
/Nmy_dts_pkg /Metl123'

MsgBox "The File Exists"
Else
MsgBox "You still need to create the file"
End If

Set objFSO = nothing

Main = DTSTaskExecResult_Success
End Function




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.