dbTalk Databases Forums  

Basic: Passing Variable Question

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


Discuss Basic: Passing Variable Question in the microsoft.public.sqlserver.dts forum.



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

Default Basic: Passing Variable Question - 09-20-2004 , 03:26 PM






I have a DTS package where I declare a date (variable)
using Active X. I then call a table to be written to
Excel.

I want to pass the variable to Excel (Connection
Properties) filname for output (dynamic file name based
on date).

I don't know how to escape this variable. Any help would
be greatly appreciated?

Thanks...

Reply With Quote
  #2  
Old   
Mary Bray
 
Posts: n/a

Default Re: Basic: Passing Variable Question - 09-21-2004 , 03:46 AM






You could try creating the complete excel file name as another Global
Variable at the same time, then use Dynamic Properties to set the name of
the Connection Property.
If you are in script look up BOL and using GlobalVariables eg:
'Declare the package and global variable objects.
Dim objPackage As DTS.Package2
Dim objGlobal As DTS.GlobalVariable
.. . .
'Define the global variable.
Set objGlobal = objPackage.GlobalVariables.New("ALuckyName")
objGlobal.Value = "SevenSevenSeven"
objPackage.GlobalVariables.Add objGlobal

"Mike Anderson" <manderson (AT) nationalcarenetwork (DOT) com> wrote

Quote:
I have a DTS package where I declare a date (variable)
using Active X. I then call a table to be written to
Excel.

I want to pass the variable to Excel (Connection
Properties) filname for output (dynamic file name based
on date).

I don't know how to escape this variable. Any help would
be greatly appreciated?

Thanks...



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

Default Re: Basic: Passing Variable Question - 09-21-2004 , 06:58 AM



In message <ui3M4d7nEHA.2804 (AT) TK2MSFTNGP09 (DOT) phx.gbl>, Mary Bray
<reply (AT) tonewsgroup (DOT) com.NOSPAMPLEASE> writes
Quote:
You could try creating the complete excel file name as another Global
Variable at the same time, then use Dynamic Properties to set the name of
the Connection Property.
If you are in script look up BOL and using GlobalVariables eg:
'Declare the package and global variable objects.
Dim objPackage As DTS.Package2
Dim objGlobal As DTS.GlobalVariable
. . .
'Define the global variable.
Set objGlobal = objPackage.GlobalVariables.New("ALuckyName")
objGlobal.Value = "SevenSevenSeven"
objPackage.GlobalVariables.Add objGlobal

"Mike Anderson" <manderson (AT) nationalcarenetwork (DOT) com> wrote in message
news:26d201c49f50$2a0ad6d0$a501280a (AT) phx (DOT) gbl...
I have a DTS package where I declare a date (variable)
using Active X. I then call a table to be written to
Excel.

I want to pass the variable to Excel (Connection
Properties) filname for output (dynamic file name based
on date).

I don't know how to escape this variable. Any help would
be greatly appreciated?

Thanks...

Same principal as Access shown here, to do this in script-
How can I change the filename for an Access Connection?
(http://www.sqldts.com/default.aspx?201)
--
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
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.