Hi Guys,

I have a text file which looks like this

123456 Amanda Morris

and I would like it to look like this
"123456","Amanda","Morris"

The file has about 2000 lines how would I go about inserting the quotes and the commas.

I use textpad to open the textfile and I am using sql server 2000.

Thanks in advance for you help.

Recommended Answers

All 6 Replies

I do not understand what this has to do with database?

If you have all this stuff in a table try:

select '"'+name+'",' from ATABLE

I think you should look into using DTS or SSIS (depending on SQL version) to bring the information in, then export it out.

This is a 5 minute job if you're familiar with DTS or SSIS.

Yes, there are very simple solutions to this problem, but it would be very nice if bajanstar can clarify his intentions. Otherwise we wasting our time to provide numerous solutions to lousy specified requirements...

Peter,

It seemed his/her question was pretty straight forward and geared towards flat files and text manipulation. You earlier replied with "I do not understand what this has to do with database?". How would one not know what the OP is looking for based on the fact he has a Tab Delimited File (assuming) and is looking to make it CSV with text qualifiers? What does that NOT have to do with a database, especially MSSQL. Please try to provide something constructive in the future.

My bad, I forgot this possibility. It will be because I attempted only once, but on the end I did just quick Java code to sort it out... ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.