dbTalk Databases Forums  

Transform Data Task

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


Discuss Transform Data Task in the microsoft.public.sqlserver.dts forum.



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

Default Transform Data Task - 01-07-2004 , 04:48 AM






If I have a Transform Data Task importing a text file to
a table. The table has 1 more field (Trancount)which
is a Integer field, than the text file. Is it possible to
use the activex part of the Transform Data Task and inset
a number into the Trancount field for each record
inserted and if so How ??

I.e if the file has three records the table will have
the following data

Fld1 Fld2 Fld3 Fld4 Fld5 TranCount

A B C D E 1
A H D Q Q 2
D D D S D 3

Thnaks again for all your help

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

Default Re: Transform Data Task - 01-07-2004 , 05:30 AM






Yes

Use a Global Variable. You will also need to use an ActiveX transform.

You could also simply set the field to have an identity property



--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peter Newman" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
If I have a Transform Data Task importing a text file to
a table. The table has 1 more field (Trancount)which
is a Integer field, than the text file. Is it possible to
use the activex part of the Transform Data Task and inset
a number into the Trancount field for each record
inserted and if so How ??

I.e if the file has three records the table will have
the following data

Fld1 Fld2 Fld3 Fld4 Fld5 TranCount

A B C D E 1
A H D Q Q 2
D D D S D 3

Thnaks again for all your help



Reply With Quote
  #3  
Old   
Peter Newman
 
Posts: n/a

Default Re: Transform Data Task - 01-07-2004 , 05:46 AM



How Allen?

Quote:
-----Original Message-----
Yes

Use a Global Variable. You will also need to use an
ActiveX transform.

You could also simply set the field to have an identity
property



--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peter Newman" <anonymous (AT) discussions (DOT) microsoft.com
wrote in message
news:083501c3d50b$bfd0baf0$a501280a (AT) phx (DOT) gbl...
If I have a Transform Data Task importing a text file
to
a table. The table has 1 more field (Trancount)which
is a Integer field, than the text file. Is it possible
to
use the activex part of the Transform Data Task and
inset
a number into the Trancount field for each record
inserted and if so How ??

I.e if the file has three records the table will have
the following data

Fld1 Fld2 Fld3 Fld4 Fld5 TranCount

A B C D E 1
A H D Q Q 2
D D D S D 3

Thnaks again for all your help


.


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

Default Re: Transform Data Task - 01-07-2004 , 05:57 AM



OK

Let's walk through an example then

CREATE TABLE AddAColumnAtRuntime(col1 int, col2 int, colRunningVal int)

My Text file looks like this

1,2
2,3
3,4
4,5
5,6


My ActiveX transform looks like this

Function Main()
DTSDestination("col1") = DTSSource("Col001")
DTSDestination("col2") = DTSSource("Col002")
DTSDestination("colRunningVal") = DTSGlobalVariables("gv_Counter").Value
DTSGlobalVariables("gv_Counter").Value =
Cint(DTSGlobalVariables("gv_Counter").Value) + 1
Main = DTSTransformStat_OK
End Function



SELECT * FROM AddAColumnAtRuntime

col1 col2 colRunningVal
----------- ----------- -------------
1 2 0
2 3 1
3 4 2
4 5 3
5 6 4

(5 row(s) affected)




--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peter Newman" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
How Allen?

-----Original Message-----
Yes

Use a Global Variable. You will also need to use an
ActiveX transform.

You could also simply set the field to have an identity
property



--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peter Newman" <anonymous (AT) discussions (DOT) microsoft.com
wrote in message
news:083501c3d50b$bfd0baf0$a501280a (AT) phx (DOT) gbl...
If I have a Transform Data Task importing a text file
to
a table. The table has 1 more field (Trancount)which
is a Integer field, than the text file. Is it possible
to
use the activex part of the Transform Data Task and
inset
a number into the Trancount field for each record
inserted and if so How ??

I.e if the file has three records the table will have
the following data

Fld1 Fld2 Fld3 Fld4 Fld5 TranCount

A B C D E 1
A H D Q Q 2
D D D S D 3

Thnaks again for all your help


.




Reply With Quote
  #5  
Old   
Peter Newman
 
Posts: n/a

Default Re: Transform Data Task - 01-07-2004 , 06:08 AM



Allan,

What would i do with out your help. Thanks once again,
especially for the examples

Pete
Quote:
-----Original Message-----
OK

Let's walk through an example then

CREATE TABLE AddAColumnAtRuntime(col1 int, col2 int,
colRunningVal int)

My Text file looks like this

1,2
2,3
3,4
4,5
5,6


My ActiveX transform looks like this

Function Main()
DTSDestination("col1") = DTSSource("Col001")
DTSDestination("col2") = DTSSource("Col002")
DTSDestination("colRunningVal") = DTSGlobalVariables
("gv_Counter").Value
DTSGlobalVariables("gv_Counter").Value =
Cint(DTSGlobalVariables("gv_Counter").Value) + 1
Main = DTSTransformStat_OK
End Function



SELECT * FROM AddAColumnAtRuntime

col1 col2 colRunningVal
----------- ----------- -------------
1 2 0
2 3 1
3 4 2
4 5 3
5 6 4

(5 row(s) affected)




--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peter Newman" <anonymous (AT) discussions (DOT) microsoft.com
wrote in message
news:038301c3d513$d5334db0$a001280a (AT) phx (DOT) gbl...
How Allen?

-----Original Message-----
Yes

Use a Global Variable. You will also need to use an
ActiveX transform.

You could also simply set the field to have an
identity
property



--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server
Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Peter Newman" <anonymous (AT) discussions (DOT) microsoft.com
wrote in message
news:083501c3d50b$bfd0baf0$a501280a (AT) phx (DOT) gbl...
If I have a Transform Data Task importing a text
file
to
a table. The table has 1 more field (Trancount)
which
is a Integer field, than the text file. Is it
possible
to
use the activex part of the Transform Data Task and
inset
a number into the Trancount field for each record
inserted and if so How ??

I.e if the file has three records the table will
have
the following data

Fld1 Fld2 Fld3 Fld4 Fld5 TranCount

A B C D E 1
A H D Q Q 2
D D D S D 3

Thnaks again for all your help


.



.


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.