dbTalk Databases Forums  

Using a constant value in data transform task

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


Discuss Using a constant value in data transform task in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Terry via SQLMonster.com
 
Posts: n/a

Default Using a constant value in data transform task - 07-25-2005 , 02:09 PM







Hi. I have a dts package that loads data from a fixed length text file into
a table. I would like to insert the filename into a column in the table so
that I can track the records inserted from which source file. I have the
script to get the filename, but I don't know how to pass this information to
the data transform task into the "sourcefile" column. Can I assign it to a
global variable and use the variable as constant in the task?

Any help would be appreciated. Thanks.

-Terry


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...r-dts/200507/1

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

Default Re: Using a constant value in data transform task - 07-25-2005 , 02:25 PM






Ok So I presume you have a column in the destination to hold the variable
value.

I do not know how your transforms are set up but here is one way of doing
this and I do it all the time.

In the destination columns list in the transformations tab select the
destination column you want to be populated.

Create a new Active Script transform
In the properties of the transform make sure no source columns are chosen.

Now in the active Script itself you simply do this

DTSDestination("Column Name") = DTSGlobalVariables("Retrieved
Filename").Value

When you come back to the trasnformations tab you should see a transform
starting over the top of the source columns i.e. not attached and the
destination is your destination column.

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Terry via SQLMonster.com" <forum (AT) SQLMonster (DOT) com> wrote

Quote:
Hi. I have a dts package that loads data from a fixed length text file
into
a table. I would like to insert the filename into a column in the table
so
that I can track the records inserted from which source file. I have the
script to get the filename, but I don't know how to pass this information
to
the data transform task into the "sourcefile" column. Can I assign it to
a
global variable and use the variable as constant in the task?

Any help would be appreciated. Thanks.

-Terry


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...r-dts/200507/1



Reply With Quote
  #3  
Old   
Terry via SQLMonster.com
 
Posts: n/a

Default Re: Using a constant value in data transform task - 07-26-2005 , 09:03 AM




Allan,
Thanks for the help on this! This worked perfectly.

-Terry

Allan Mitchell wrote:
Quote:
Ok So I presume you have a column in the destination to hold the variable
value.

I do not know how your transforms are set up but here is one way of doing
this and I do it all the time.

In the destination columns list in the transformations tab select the
destination column you want to be populated.

Create a new Active Script transform
In the properties of the transform make sure no source columns are chosen.

Now in the active Script itself you simply do this

DTSDestination("Column Name") = DTSGlobalVariables("Retrieved
Filename").Value

When you come back to the trasnformations tab you should see a transform
starting over the top of the source columns i.e. not attached and the
destination is your destination column.

Hi. I have a dts package that loads data from a fixed length text file
into
[quoted text clipped - 10 lines]

-Terry

--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...r-dts/200507/1


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.