Andrew Venture
Andrew Venture

Reputation: 327

How to import Text Delimited File to SQL Database?

In general I know how to import tab delimited file or comma delimited file. One of my client sent me delimited file. Example you can see below. And I don't how to import it without quotes.

"Make","Model","ModelYear","Trim","BodyStyle","Mileage","EngineDescription","Cylinders","FuelType","Transmission"
"Dodge","Stealth","1993","ES","Hatchback","107000","V-6","6-Cylinder","Gasoline",""
"GMC","Envoy XL","2003","SLE","Sport Utility","116000","6cyl","6-Cylinder","Gasoline","Automatic"

Could you guide me how to import and what settings do I need to change in order to import it with import wizard?

Thank you

Upvotes: 8

Views: 34770

Answers (3)

RThomas
RThomas

Reputation: 10882

If the data is very simplistic you can use the SSMS import wizard. Right click the database, select tasks, select Import Data, and has been pointed out identify quotes as the text qualifier.

For a csv, tab delimited file you would change Data Source option to: Flat File Source

From there just answer the questions and follow the prompts.

I will warn you however. Unless the data is very simplistic, this method tends to produce a lot of errors. I almost always end up using SSIS which is a little more hassle and complex but a whole lot more powerful and dependable.

Upvotes: 1

Abe Miessler
Abe Miessler

Reputation: 85036

People might say it's a bit krufty, but the easiest way might be to open it as a CSV in excel and then copy/paste it right into your table using Management Studio.

If you are trying to do anything fancier than that, this method won't work. If not, you would be hard pressed to find a faster way to do it.

Upvotes: 6

Will A
Will A

Reputation: 24988

You need to set the "Text qualifier" to ".

enter image description here

Upvotes: 14

Related Questions