Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 HElP with export of tables..

Author  Topic 

p_augustus
Starting Member

3 Posts

Posted - 2004-07-08 : 18:26:56
I need to export a fixed number of fields from different(multiple) Sybase tables and write it as a formatted string to an ASCII file.

Can i use bcp for this??

Will it represent NULL correctly??

Do i need to bcp out each table individually or is there a way i can combine fields from all the tables and bcp out to a single file???

Do i need to write a separate 'c' program to parse through the bcp output and create a string.

For example,

there are two fields : Name & Phone number

But my text file needs to have it in the format

"Subscriber:name=<>&phonenumber:<>;"

Please suggest a way to do this.

p_augustus
Starting Member

3 Posts

Posted - 2004-07-09 : 16:43:21
any suggestions would be great !!!

Please HELP!!!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-07-09 : 16:50:10
You've posted your question on a MS SQL Server site. Is this SQL Server related? I believe bcp is a utility of both products, but we would be providing MS SQL Server specific information. You might try [url]http://www.dbforums.com[/url]. They have a Sybase forum.

Tara
Go to Top of Page

p_augustus
Starting Member

3 Posts

Posted - 2004-07-09 : 17:02:25
Thanks.
I'm a complete novice and thought it would be the same for both.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-07-09 : 17:11:09
With MS' version of bcp, you can use a query to bcp the data out. So if you can write a query that represents the data that you need, then you can use bcp. Can the columns all be pulled together with joins? If they can't, you can bcp out each table to an individual file, then concatenate the files together with a DOS command:

type C:\PathToBcpFiles\*.* > C:\ConcatenatedFile.txt

Tara
Go to Top of Page
   

- Advertisement -