SQL data type conversion function

Source: Internet
Author: User

Show Conversion function has cast,convert two kinds

Syntax format: cast (expression as data_type)

Syntax format: CONVERT (data_type,expression)

Example: Cast (' 003 ' as int)

Convert (int, ' 003 ')

Attention:

Data_type the data type that must be defined for the database system, the custom type cannot be used

When char or varchar is converted to int, the result must be a number with a sign

A maximum of 8,000 characters when the text type is converted to char or varchar

Up to 8,000 characters when the image type is converted to binary or varbinary

When an integer is converted to Money or smallmoney, it is required to be in the currency unit of the defined country or region.

SQL data type conversion function

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.