SqlCONVERT () string to integer date character type

Source: Internet
Author: User
Converts a sqlconvert () string to an integer, and converts a datetime string to a datetime string: convert (data_type (length), data_to_be_converted, style) instance selectconvert (varchar (30), getdate (), 101) now to integer convert (int, column) if I want to convert the mobile phone number to integer, select SQL convert () string to integer date converter type

Convert to date writing

Convert (data_type (length), data_to_be_converted, style)

Instance

Select convert (varchar (30), getdate (), 101) now


Convert to integer

Convert (int, column)

If I want to convert a mobile phone number into an integer,

Select convert (int (8), mo) moint

An error is reported. Why? Let's take a look at the instance.

Select convert (bigint, mo) moint


This is correct because the number type is incorrect. The mobile phone number is 11 bits, while the int type can only be 8 bits. Naturally

An error occurs.

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.