473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Datatable to Tab Delimited Text file

RSH
Hi,

I have a situation where I am querying SQL Server and bringing back a
Dataset. Is there a way to dump the datatable to a delimited text file
without iteration through the datatable?

The reason i need to do this is I am having to traverse a large number of
databases and the with iteration the process is taking quite a long time.

Thanks in advance!
Ron
Jan 16 '07 #1
2 4039
I propose that you use DTS for this activity instead.

However,

In the past, I have dumped the xml of a datatable into a stringbuilder, and
executed a series of replace statemements. Finally, I iterate over the
columnnames of the table and insert them at the beginning of the string
builder for the row header.

Hope that helps.

<Newtable>
<datarow><Column1>Blah</Column1><Column2>Blah1</Column2></datarow>
</Newtable>

becomes
"Column1","Column2"
"Blah","Blah1"
"RSH" <wa*************@yahoo.comwrote in message
news:Oj**************@TK2MSFTNGP03.phx.gbl...
Hi,

I have a situation where I am querying SQL Server and bringing back a
Dataset. Is there a way to dump the datatable to a delimited text file
without iteration through the datatable?

The reason i need to do this is I am having to traverse a large number of
databases and the with iteration the process is taking quite a long time.

Thanks in advance!
Ron

Jan 16 '07 #2
There are of course other ways to go.

Instead of populating a datatable, which would be discarded anyway. Use a
DataReader and just stream the results into a text file on the fly. Perhaps
this would have the lowest impact on resources and time.

"AMDRIT" <am****@hotmail.comwrote in message
news:uU**************@TK2MSFTNGP03.phx.gbl...
>I propose that you use DTS for this activity instead.

However,

In the past, I have dumped the xml of a datatable into a stringbuilder,
and executed a series of replace statemements. Finally, I iterate over
the columnnames of the table and insert them at the beginning of the
string builder for the row header.

Hope that helps.

<Newtable>
<datarow><Column1>Blah</Column1><Column2>Blah1</Column2></datarow>
</Newtable>

becomes
"Column1","Column2"
"Blah","Blah1"
"RSH" <wa*************@yahoo.comwrote in message
news:Oj**************@TK2MSFTNGP03.phx.gbl...
>Hi,

I have a situation where I am querying SQL Server and bringing back a
Dataset. Is there a way to dump the datatable to a delimited text file
without iteration through the datatable?

The reason i need to do this is I am having to traverse a large number of
databases and the with iteration the process is taking quite a long time.

Thanks in advance!
Ron


Jan 16 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ben | last post by:
Hi all - I am having a bit of trouble and thought maybe someone in this group could shed some light. Here's the skinny... I am creating an automated process to import a bunch of text files...
12
by: Jonathan | last post by:
How do you tell the .csv file that you are to import that it has no row headers as I went to the web site http://www.connectionstrings.com/ and under text file it says: "HDR=Yes;" indicates that...
4
by: Rich | last post by:
I understand that the stringbuilder object can create a string of text much more quickly/efficiently than a string object. I am just checking - if I have a textfile with say 1000 rows of data -...
0
by: Masa Ito | last post by:
I have pipe delimited (and comma/tab) files that I read with JET using a schema file. Occasionally a field has multiple quotes (") inside a single field - which chokes the line (the rest of the...
6
by: kevin | last post by:
I need to parse an third party supplied delimited or fixed width text file into a datatable. The delimiter may vary. I am currently using a SteamReader to read each line and, for delimited...
6
by: =?Utf-8?B?UmljaA==?= | last post by:
'--this code works but only reads text into one column when contains multiple cols Dim ds1x As New DataSet Dim ConStr As String = _ "Provider=Microsoft.Jet.OLEDB.4.0;Data...
7
by: archana | last post by:
Hi all, I have csv file which i want to show into datatable. when i try to use oledb to copy content of csv file into datatable not all rows are getting copied into datatable. Some last rows...
4
by: =?Utf-8?B?TWlrZSBE?= | last post by:
I read the CSV file into a DataTable. This is so I can fix invalid dates and other data I don't want in the database. Then I use SqlBulkCopy to insert the data into the SQL database. All the...
19
by: cj2 | last post by:
#1 Is there a quick way to export a datatable to an excel file? Or delimited file? #2 Where is the appropriate Microsoft monitored group to ask about writing reports in SQL Reporting services...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.