dbTalk Databases Forums  

transforming the export

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


Discuss transforming the export in the microsoft.public.sqlserver.dts forum.



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

Default transforming the export - 07-07-2004 , 11:19 AM






How can I get a DTS Package to export data from the Customer's table
of Northwind like this:

CUSTOMERID:ALFKI
COMPANYNAME:Alfreds Futterkiste
CONTACTNAME:Maria Anders
COUNTRY:Germany

CUSTOMERID:ANATR
COMPANYNAME:Ana Trujillo Emparedados y helados
CONTACTNAME:Ana Trujillo
COUNTRY:Mexico

CUSTOMERID:ANTON
COMPANYNAME:Antonio Moreno Taquería
CONTACTNAME:Antonio Moreno
COUNTRY:Mexico

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

Default Re: transforming the export - 07-07-2004 , 11:51 AM






Export it to what?

Process each relevant part but not pick up the next row until you have
processed the COUNTRY attribute.
You can then pick up the next row
Your destination would be a 1 attribute only though right.

We do something similar here.

Processing The Same Row More Than Once
(http://www.sqldts.com/default.aspx?266)


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


Reply With Quote
  #3  
Old   
DHatheway
 
Posts: n/a

Default Re: transforming the export - 07-07-2004 , 01:17 PM



You might be able to get away with something like this:

select 'customerid:'+t.customerid+char(13)+char(10)
+'COMPANYNAME:'+t.companyname+char(13)+char(10)
+'CONTACTNAME:'+t.contactname+char(13)+char(10)
+'COUNTRY:'+t.country+char(13)+char(10)+char(13)+c har(10)
from customers t

and sending the output to your destination file. I'm not sure how a
transformation task would like this query but you could run the query via
ISQL and redirect the output to a text file. Let's say you put this query
into the file "select.sql". You'd run this command:

isql /E /S <myserver> /i select.sql /o customers.txt

in a command prompt window. There are some switches, settings and set
commands you can look up to suppress the row counts and title lines to clean
up your output.

You might be able to define that select as a view and bcp it to a file, too.
That would eliminate row counts and title lines, for sure.

"Vincent Jones" <vncntj (AT) hotmail (DOT) com> wrote

Quote:
How can I get a DTS Package to export data from the Customer's table
of Northwind like this:

CUSTOMERID:ALFKI
COMPANYNAME:Alfreds Futterkiste
CONTACTNAME:Maria Anders
COUNTRY:Germany

CUSTOMERID:ANATR
COMPANYNAME:Ana Trujillo Emparedados y helados
CONTACTNAME:Ana Trujillo
COUNTRY:Mexico

CUSTOMERID:ANTON
COMPANYNAME:Antonio Moreno Taquería
CONTACTNAME:Antonio Moreno
COUNTRY:Mexico



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

Default Re: transforming the export - 07-07-2004 , 01:51 PM



In article <#agHj6EZEHA.3596 (AT) tk2msftngp13 (DOT) phx.gbl>, DHatheway wrote:
Quote:
You might be able to get away with something like this:

select 'customerid:'+t.customerid+char(13)+char(10)
+'COMPANYNAME:'+t.companyname+char(13)+char(10)
+'CONTACTNAME:'+t.contactname+char(13)+char(10)
+'COUNTRY:'+t.country+char(13)+char(10)+char(13)+c har(10)
from customers t

and sending the output to your destination file. I'm not sure how a
transformation task would like this query but you could run the query via
ISQL and redirect the output to a text file. Let's say you put this query
into the file "select.sql". You'd run this command:

isql /E /S <myserver> /i select.sql /o customers.txt

in a command prompt window. There are some switches, settings and set
commands you can look up to suppress the row counts and title lines to clean
up your output.

You might be able to define that select as a view and bcp it to a file, too.
That would eliminate row counts and title lines, for sure.

"Vincent Jones" <vncntj (AT) hotmail (DOT) com> wrote in message
news:ba2a2d30.0407070819.59d34f63 (AT) posting (DOT) google.com...
How can I get a DTS Package to export data from the Customer's table
of Northwind like this:

CUSTOMERID:ALFKI
COMPANYNAME:Alfreds Futterkiste
CONTACTNAME:Maria Anders
COUNTRY:Germany

CUSTOMERID:ANATR
COMPANYNAME:Ana Trujillo Emparedados y helados
CONTACTNAME:Ana Trujillo
COUNTRY:Mexico

CUSTOMERID:ANTON
COMPANYNAME:Antonio Moreno Taquería
CONTACTNAME:Antonio Moreno
COUNTRY:Mexico

That method would work for adding all source attributes to 1 destination
attribute row together but I may have misread the post and thought that each
part was a seperate row????


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



Reply With Quote
  #5  
Old   
DHatheway
 
Posts: n/a

Default Re: transforming the export - 07-07-2004 , 02:50 PM



"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
In article <#agHj6EZEHA.3596 (AT) tk2msftngp13 (DOT) phx.gbl>, DHatheway wrote:
You might be able to get away with something like this:

select 'customerid:'+t.customerid+char(13)+char(10)
+'COMPANYNAME:'+t.companyname+char(13)+char(10)
+'CONTACTNAME:'+t.contactname+char(13)+char(10)
+'COUNTRY:'+t.country+char(13)+char(10)+char(13)+c har(10)
from customers t

and sending the output to your destination file. I'm not sure how a
transformation task would like this query but you could run the query
via
ISQL and redirect the output to a text file. Let's say you put this
query
into the file "select.sql". You'd run this command:

isql /E /S <myserver> /i select.sql /o customers.txt

in a command prompt window. There are some switches, settings and set
commands you can look up to suppress the row counts and title lines to
clean
up your output.

You might be able to define that select as a view and bcp it to a file,
too.
That would eliminate row counts and title lines, for sure.

"Vincent Jones" <vncntj (AT) hotmail (DOT) com> wrote in message
news:ba2a2d30.0407070819.59d34f63 (AT) posting (DOT) google.com...
How can I get a DTS Package to export data from the Customer's table
of Northwind like this:

CUSTOMERID:ALFKI
COMPANYNAME:Alfreds Futterkiste
CONTACTNAME:Maria Anders
COUNTRY:Germany

CUSTOMERID:ANATR
COMPANYNAME:Ana Trujillo Emparedados y helados
[...]
That method would work for adding all source attributes to 1 destination
attribute row together but I may have misread the post and thought that
each
part was a seperate row????

Allan Mitchell (Microsoft SQL Server MVP)
I did make some assumptions and maybe cut some corners. I figured he was
sending this to a plain vanilla text file of some sort and with this
approach each attribute would end up on a separate "line" (unless he's got a
weird-oh OS that does something peculiar with output records - but it's
almost a given that Wintel is involved). If he opens the resulting text
file back with Notepad, it would certainly look like what he requested. I
admit he might encounter some strangeness down the line (although, if you
FTP'ed it to most of the systems I'm familiar with, the file at the
destination would probably be useable).

Of course, he's not actually paying us to solve his problem, now, is he?
For actual cash, I'd cover all the bases. :-)





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

Default Re: transforming the export - 07-08-2004 , 12:06 AM



In article <ees9juFZEHA.2516 (AT) TK2MSFTNGP10 (DOT) phx.gbl>, DHatheway wrote:
Quote:
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:VA.00000079.11f31c05 (AT) no-spam (DOT) sqldts.com...
In article <#agHj6EZEHA.3596 (AT) tk2msftngp13 (DOT) phx.gbl>, DHatheway wrote:
You might be able to get away with something like this:

select 'customerid:'+t.customerid+char(13)+char(10)
+'COMPANYNAME:'+t.companyname+char(13)+char(10)
+'CONTACTNAME:'+t.contactname+char(13)+char(10)
+'COUNTRY:'+t.country+char(13)+char(10)+char(13)+c har(10)
from customers t

and sending the output to your destination file. I'm not sure how a
transformation task would like this query but you could run the query
via
ISQL and redirect the output to a text file. Let's say you put this
query
into the file "select.sql". You'd run this command:

isql /E /S <myserver> /i select.sql /o customers.txt

in a command prompt window. There are some switches, settings and set
commands you can look up to suppress the row counts and title lines to
clean
up your output.

You might be able to define that select as a view and bcp it to a file,
too.
That would eliminate row counts and title lines, for sure.

"Vincent Jones" <vncntj (AT) hotmail (DOT) com> wrote in message
news:ba2a2d30.0407070819.59d34f63 (AT) posting (DOT) google.com...
How can I get a DTS Package to export data from the Customer's table
of Northwind like this:

CUSTOMERID:ALFKI
COMPANYNAME:Alfreds Futterkiste
CONTACTNAME:Maria Anders
COUNTRY:Germany

CUSTOMERID:ANATR
COMPANYNAME:Ana Trujillo Emparedados y helados
[...]
That method would work for adding all source attributes to 1 destination
attribute row together but I may have misread the post and thought that
each
part was a seperate row????

Allan Mitchell (Microsoft SQL Server MVP)

I did make some assumptions and maybe cut some corners. I figured he was
sending this to a plain vanilla text file of some sort and with this
approach each attribute would end up on a separate "line" (unless he's got a
weird-oh OS that does something peculiar with output records - but it's
almost a given that Wintel is involved). If he opens the resulting text
file back with Notepad, it would certainly look like what he requested. I
admit he might encounter some strangeness down the line (although, if you
FTP'ed it to most of the systems I'm familiar with, the file at the
destination would probably be useable).

Of course, he's not actually paying us to solve his problem, now, is he?
For actual cash, I'd cover all the bases. :-)

I think between us we got it covered <grin>


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



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.