Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

Import Flat File does not allow import of bit when values are 0 or 1 in SSMS 17.3

When I import a file that uses 1 or 0 as true and false the import fails because it cannot convert 1 or 0 to a BIT. Here is the error that is returned. To make this work I changed the columns to TINYINT. After the table is populated I altered the columns to be BIT and it completed successfully.

TITLE: Microsoft SQL Server Management Studio
------------------------------

Error inserting data into table. (Microsoft.SqlServer.Import.Wizard)

------------------------------
ADDITIONAL INFORMATION:

Error inserting data into table. (Microsoft.SqlServer.Prose.Import)

------------------------------

The given value of type String from the data source cannot be converted to type bit of the specified target column. (System.Data)

------------------------------

Failed to convert parameter value from a String to a Boolean. (System.Data)

------------------------------

String was not recognized as a valid Boolean. (mscorlib)

------------------------------
BUTTONS:

OK
------------------------------

3 votes
Sign in
(thinking…)
Sign in with: oidc
Signed in as (Sign out)

We’ll send you updates on this idea

AdminMicrosoft SQL Server (Product Manager, Microsoft Azure) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Sign in with: oidc
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base