Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find patterns in the input file while importing CSV into SQL Server

I'm trying to import some pretty simple data into my SQL Server 2014 from a csv file.

In the csv file, I only have a single column with numeric data.

I'm using SQL Server Management Studio 17.6 and I connect to my database, then use Task Import Flat File feature.

This is the error I see when I pick the file and click next: enter image description here

Any idea what the problem is and how to get around it?

UPDATE:

Not quite the same as providing an actual file but here's a screen shot of the file. It contains phone numbers. I obfuscated the actual numbers so that we don't jeopardize anyone's privacy.

enter image description here

like image 304
Sam Avatar asked May 07 '18 17:05

Sam


People also ask

How do I import a TSV file into SQL Server?

SQL Server Management Studio > select target database node > open contextual menu > Tasks > Import Data ... SQL Server Integration Services > Flat File Source. T-SQL statement BULK INSERT with \t COLUMNTERMINATOR. T-SQL function OPENROWSET(BULK 'file path') with format file and \t terminator.


1 Answers

*edited original post to address the initial issue

I received the same error trying to import a csv file with only one column. This seems to be a known error with the new import flat file wizard added in SSMS 17.3. As your data only has one column, it is throwing an error at the preview data step.

The work around is to right click your database, go to tasks => import data. This will start the data import wizard and you will be able to follow the import steps here to bring your data into a table.

like image 119
Dan Avatar answered Sep 28 '22 05:09

Dan