Importing Data from Excel Wizard Automatically Detects Data Types

Hello, I am trying to import data from an excel (xls) file into a new SQL table , so I am using Import and Export data 32/bit to achieve this. When I load the excel file, it automatically determines the data types of the columns. for example, a column with phone numbers is the data type in the new float table, and in excel as Double (15) when I try to change the float to nvarchar

I get this:

Found 2 conversions (s) of unknown column type. You chose to skip 1 possible lost column transformation, You chose to skip 3 safe column conversions

And I am not allowed to continue exporting.

Is there a way to change data types when trying to import them?

Thank you for your time.

This data is specified as a text data type in excel. Example data from one of the columns in excel:

 5859031783 5851130582 8811014190 

This is what I get:

enter image description here

+6
source share
1 answer

Select a column in an Excel worksheet and change the data type to text

enter image description here

Then go to the open import-export wizard of your sql server and follow all steps to select the source data and bla bla, when you get to the Mapping Column point, by default select the Float data type, you will need to change it to NVARCHAR(N) in In my test, I changed it to NVARCHAR (400), it gave me a warning that I might lose some data, as I convert data from 1 datatyep to another.

enter image description here

When you get to the Data Type Mapping page, make sure you select the Convert check box. and stop the rejection process, if necessary.

enter image description here

After going through all these steps, finally, my data in the destination table with the same Warning , that I converted some data n bla bla after all Microsoft cares too much :)

enter image description here

Finally, the data in the Sql-Server table

 ╔═══════╦════════════╦═════════╦════════════════╦══════════════╗ ║ Name ║ City ║ Country ║ Phone ║ Float_Column ║ ╠═══════╬════════════╬═════════╬════════════════╬══════════════╣ ║ Shaun ║ London ║ UK ║ 04454165161665 ║ 5859031783 ║ ║ Mark ║ Newyork ║ USA ║ 16846814618165 ║ 8811014190 ║ ║ Mike ║ Manchester ║ UK ║ 04468151651651 ║ 5851130582 ║ ╚═══════╩════════════╩═════════╩════════════════╩══════════════╝ 
+14
source

All Articles