Wednesday, March 7, 2012

import and text qualifier

Hi

How can I import txt files, in which data sometimes can contain
the letter that is used as text qualifier

Example txt file: 'abc',123, 'john's',12

Here the word -john's- contains the same letter as the text qualifier I have to use.

Can it be true, that this can't be done i MS SQL, when it can be done in MS Excel, Paradox etc..

Regards
Carsten H.When you need to import a delimter character like the apostrophe in Transact-SQL, all computer languages need some kind of escape character to prefix the delimiter. In C or C++, you often use the backslash (\} for an escape character.

This is done automagically for you when using the text file import utilities like BCP, and manually when using Transact-SQL syntax. What tool are you using?

-PatP|||Weel, I'm not an expert at sql, so I'm using DTS and I have tried different kind of stuff using BULK INSERT|||To make the process a lot more simple, just import the text file into an Excel spreadsheet, then use DTS to import it into SQL Server from the spreadsheet's XLS file.

There are certainly ways that it can be done using just the SQL tools, but it sounds like you are a lot more comfortable using Excel, so that is probably the best route for you.

-PatP|||HATE Excel

So the answer must be, that I still have to use sql in MySql, and then throw it all back to my main db (MS SQL)

No comments:

Post a Comment