![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
|
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 |
#5
| |||
| |||
|
|
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) |
#6
| |||
| |||
|
|
"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. :-) |
![]() |
| Thread Tools | |
| Display Modes | |
| |