question

teeboy1-7818 avatar image
0 Votes"
teeboy1-7818 asked Cathyji-msft edited

Error with data types while importing flat file to SSMS

I have a .tab file to import to SSMS but when I do successfully, it shows all data types as varchar, which isn't supposed to be.

Any fix for this? Thanks.

sql-server-generalsql-server-transact-sql
· 7
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


How did you create this file and how did you import it to SSMS?

0 Votes 0 ·

Hello, it was downloaded as a .tab file.

I imported from SSMS via Tasks -> Import Data -> Flat file

0 Votes 0 ·

It seems that the file does not contain type information, but you can specify the desired types manually in the corresponding dialog.

0 Votes 0 ·
Show more comments
Cathyji-msft avatar image
0 Votes"
Cathyji-msft answered teeboy1-7818 commented

Hi @teeboy1-7818,

Did you try to use Import Flat File to SQL Wizard? Refer to Import Flat File to SQL Wizard to get more information.


If the response is helpful, please click "Accept Answer" and upvote it, thank you.



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I tried that as well, got the error in the link and can't find my way around it

0 Votes 0 ·
TomPhillips-1744 avatar image
0 Votes"
TomPhillips-1744 answered teeboy1-7818 commented

You will be much happier if you always import data into varchar fields in a "staging" table, and then use insert or update or merge to move the data into the target tables. You will have much more control over the data conversion.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks, so Bulk Insert would be the go-to way?

After creating an empty table with the datatypes I need

0 Votes 0 ·