国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 PHP開發(fā) Detailed explanation of CONVERT function in SQL

Detailed explanation of CONVERT function in SQL

Dec 14, 2016 pm 01:36 PM

The following will introduce you to the CONVERT function in SQL. The CONVERT function is a function used for data conversion in SQL. If you are interested in this, you may wish to take a look. I believe it will be helpful for you to learn SQL.

Use CONVERT:

CONVERT (data_type[(length)], expression [, style])

The parameter

expression

is any valid Microsoft? SQL Server? expression.

data_type

Data types provided by the target system, including bigint and sql_variant. User-defined data types cannot be used.

length

Optional parameter of nchar, nvarchar, char, varchar, binary or varbinary data type.

style

Date format style, which converts datetime or smalldatetime data to character data (nchar, nvarchar, char, varchar, nchar or nvarchar data type); or string format style, which converts float, real, money or smallmoney Data is converted to character data (nchar, nvarchar, char, varchar, nchar or nvarchar data types).

SQL Server supports data formats in Arabic style using Kuwaiti algorithm.

In the table, the two columns on the left represent the style values ??that convert datetime or smalldatetime into character data. Add 100 to the style value to obtain a four-digit year (yyyy) including the century digit.

style 值

* The default value (style 0 or 100, 9 or 109, 13 or 113, 20 or 120, 21 or 121) always returns the century digit (yyyy).
** Input when converted to datetime; output when converted to character data.
*** Specifically for XML. For conversion from datetime or smalldatetime to character data, the output format is as shown in the table. For conversions from float, money, or smallmoney to character data, the output is equivalent to style 2. For conversions from real to character data, the output is equivalent to style 1.


Important By default, SQL Server interprets two-digit years based on the cutoff year 2049. That is, a two-digit year 49 is interpreted as 2049, and a two-digit year 50 is interpreted as 1950. Many client applications, such as those based on OLE Automation objects, use 2030 as the cutoff year. SQL Server provides a configuration option ("Two-digit cut-off year") that allows you to change the cut-off year used by SQL Server and treat dates consistently. The safest approach, however, is to specify a four-digit year.

When converting from smalldatetime to character data, styles containing seconds or milliseconds will display zeros in these positions. When converting from datetime or smalldatetime values, you can truncate unwanted date parts by using the appropriate char or varchar data type length.

The table below shows the style values ??when converting from float or real to character data.

style 值

In the table below, the left column represents the style value when converting from money or smallmoney to character data.

style 值

Return Type


Returns the same value as data type 0.


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1501
276