SQL Server Common functions

Source: Internet
Author: User

1. CONVERT () function

?

1 CONVERT (data_type (length), Data_to_be_converted,style)

Data_type (length) sets the target data type (with an optional length). Data_to_be_converted contains values that need to be converted. Style sets the output format for date/time.

The style value you can use: Click to open the link

2, DATEADD () function

Click to open the link

3. CAST () function

?

1 2 Syntax for cast:cast (expression as data_type [(length)])

Expression

Any valid expression.

Data_type

The target data type. This includes XML, bigint, and sql_variant. You cannot use an alias data type.

Length

An optional integer specifying the length of the destination data type. The default value is 30. CONVERT () function and cast () function details: Click to open the link

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.