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
ColoplastAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

How are you importing?
Using the wizard in SSMS? or an SSIS Package?
0
ColoplastAuthor Commented:
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$]')
0
Louis01Commented:
select convert(varchar(20)
              ,convert(decimal(20,0)
                      ,convert(float, '1.23E+09')
                      )
              )

Open in new window

0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

ColoplastAuthor Commented:
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 :-)
0
ColoplastAuthor Commented:
Think I got it:

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

It seems to work as least :-)
0
ColoplastAuthor Commented:
So how do I make the change to the column do I use UPDATE?
0
Louis01Commented:
You need to reference the column name.
It might be simpler to just update it afterwards though?
update MyTable 
   set MyCol = 
       convert(varchar(20)
              ,convert(decimal(20,0)
                      ,convert(float, MyCol)
                      )
              )

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ColoplastAuthor Commented:
Thanks a lot.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.