The scientific notation is not displayed in SQL Server when float is turned to varchar

Source: Internet
Author: User

The solution for converting float to varchar into a scientific counting method in MSSQL

When the system was initialized, because of a colleague, there was no single quotation mark in front of the numeric data, resulting in a float type after entering the database
We need to make the following conversions to change the data to a varchar type

DECLARE @a float//define a float variable
Set @a = 13824658956//Assign value float variable
Select @a as a//display variable
Select CONVERT (varchar, @a) as a//display by string
Select CONVERT (Decimal (18,0), @a) as a//display by decimal digit count
Select CONVERT (Varchar,convert (decimal (18,0), @a)) as A//convert string display
 

The scientific notation is not displayed in SQL Server when float is turned to varchar

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.