Wrong on coversion different types

Helder Arnoldo Flores 20 Reputation points
2023-04-28T14:45:51.0866667+00:00

I need urgently to import a big numbers on general format from Excel to SQL Server 2017. When I do by ImportExport SQL function, the data result on Hexadecimal caracters. Example:

On Excel = 7041162000117 general or SQL float type. When Import to Varchar(14) the result is

7.04116e+012. I need to continue on normal caractere format, not on Hexa, ASCII or similar.

It's a document numbers on my database and many the first caracatere is '0'. How can I do Please? It's urgently. Thanks a lot

Helder Flores

SQL Server | Other
{count} votes

Accepted answer
  1. Erland Sommarskog 121.9K Reputation points MVP Volunteer Moderator
    2023-04-28T20:48:15.21+00:00

    I think you are better off importing them as bigint. I believe that Excel saves numbers this big as floating-point values, so the scientific format is perfectly logical.


1 additional answer

Sort by: Most helpful
  1. Helder Arnoldo Flores 20 Reputation points
    2023-05-01T20:02:31.1166667+00:00

    HEY.

    I apologize for not having commented on your answers. I decided to matter to Bigint, then I passed the field to Varchar (14), then completed with 0 (zeros) left those who had less than 14 characters. I solved the emergence, but I am not able to automate the process, because you can not be changing the Type of the field in all imports. And when I convert to String, again he becomes a pile of numbers and letters, incomprehensible. Very bad that there is no more viable solution to these situations. But thank you very much for your will and help from you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.