Link to home
Start Free TrialLog in
Avatar of Coloplast
ColoplastFlag for Denmark

asked on

Converting scientific "text" numbers into normal numbers

I have imported data from Excel into SQL.
When the data arrives in the SQL column it's scientific (E+)
My column in SQL is VARCHAR(20).
This is fine by me, but I need a script that will change the scientific to a normal number.
The formatting of the colum must stay as VARCHAR(20).
Hope you can help.
Regards
Rasmus Holt
Avatar of Tony303
Tony303
Flag of New Zealand image

Has Excel got the column showing the scientific (+E) value?

How are you importing?
Using the wizard in SSMS? or an SSIS Package?
Avatar of Coloplast

ASKER

In Excel it's numbers.
I import like this:

TRUNCATE TABLE Vipcolo
INSERT INTO dbo.Vipcolo
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=D:\DEAvayaRouting\Vipcolo.xlsx','select * from [sheet1$]')
select convert(varchar(20)
              ,convert(decimal(20,0)
                      ,convert(float, '1.23E+09')
                      )
              )

Open in new window

Thanks.
I'm not an T-SQL expert, can you help with the rest of the code as well?
What do I put instead of '1.23E+09'
Shall I add a FROM as well?
Sorry :-)
Think I got it:

select convert(varchar(20)
              ,convert(decimal(20,0)
                      ,convert(float, VIP)
                      )
              )
FROM Vipcolo

It seems to work as least :-)
So how do I make the change to the column do I use UPDATE?
ASKER CERTIFIED SOLUTION
Avatar of Louis01
Louis01
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks a lot.