How to import text delimited file into SQL database?

In general, I know how to import a tab delimited file or comma delimited file. One of my clients sent me a delimited file. An example that you can see below. And I can not 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 please tell me how to import and what parameters need to be changed in order to import it using the import wizard?

thanks

+6
source share
3 answers

You need to set the Text Classifier to.

enter image description here

+12
source

People may say this a little krufty, but the easiest way is to open it as CSV in excel and then copy / paste it directly into your spreadsheet using Management Studio.

If you are trying to do something more interesting, this method will not work. If not, it will be difficult for you to find a faster way to do this.

+6
source

If the data is very simplified, you can use the SSMS Import Wizard. Right-click the database, select tasks, select "Import Data" and indicate that quotation marks are specified as a text classifier.

For a csv file with tab delimiters, you must change the "Data source": "Flat file"

From there, just answer the questions and follow the instructions.

However, I will warn you. If the data is not very simplified, this method usually causes a lot of errors. I almost always use SSIS , which is a bit more complicated and more complicated, but much more powerful and reliable.

+1
source

Source: https://habr.com/ru/post/890717/


All Articles