dbTalk Databases Forums  

ActiveX Script Help.

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


Discuss ActiveX Script Help. in the microsoft.public.sqlserver.dts forum.



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

Default ActiveX Script Help. - 12-09-2004 , 02:57 PM






Can someone point me in the right direction for an ActiveX Task. I am not
very profecient in VBScipt.

As a part of the DTS package I want to move a file to a location for
archiving. I want to rename the file with a record from a SQL Table. I know
the syntax for moving the file and renaming it, etc. I just need to know how
to be able to query the table to get the data I need for the rename. Can
I(And how) accomplish this through the Dynamic Properties task. I am
examining it now, but still need a bit of help. Any help, as always, is
appreciated. Thanks!

Reply With Quote
  #2  
Old   
Robert Davis
 
Posts: n/a

Default RE: ActiveX Script Help. - 12-09-2004 , 03:45 PM






Create an ADO connection to the database and query the table. Like so:

Dim oCon
Dim oRS
Dim sSQL
Dim sDSN

sDSN = "Driver={SQL Server};Server=" & DTSGlobalVariables( "ServerName"
).Value & "; Database=" & DTSGlobalVariables( "DatabaseName" ).Value &
";Trusted_Connection=YES"

Set oCon = CreateObject("ADODB.Connection")
oCon.Open strDSN

sSQL = "Select Field From Table Where X = Y"

Set oRS = oCon.Execute(sSQL)

If Not oRS.EOF And Not oRS.BOF Then
' Set Filename = vlaue of oRS("Field") or oRS(0)
End If

oRS.Close
Set oRS = nothing
oCon.Close
Set oCon = nothing

"Jeff York" wrote:

Quote:
Can someone point me in the right direction for an ActiveX Task. I am not
very profecient in VBScipt.

As a part of the DTS package I want to move a file to a location for
archiving. I want to rename the file with a record from a SQL Table. I know
the syntax for moving the file and renaming it, etc. I just need to know how
to be able to query the table to get the data I need for the rename. Can
I(And how) accomplish this through the Dynamic Properties task. I am
examining it now, but still need a bit of help. Any help, as always, is
appreciated. Thanks!

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.