Format:Convert(Data_type, expression[, Style])Convert(Varchar, field name,Format type)
Note:This style is generally in the time type (datetime, smalldatetime) and string type (nchar, nvarchar, Char, varchar)It is used only when they are converted to each other.
Example:Select convert (varchar (30), getdate (), 101) nowResult:Now---------------------------------------| 09/15/2001
=======================
The time format normally deposited in the database is yyyy-mm-ddhh:mm:ss if you want to convert to yyyy-mm-dd Short date format. You can use the CONVERT function. The following is a declaration of the CONVERT function in SQL Server Help:Using CONVERT:CONVERT (data_type[(length)],expression[,style])ParametersExpressionIs any valid microsoft®sql Server™ expression.
Tags: system val SQL numeric GPO conversion nvarchar diff lisCONVERT (varchar (10), field name, conversion format)Convert is a date conversion function, which is typically used when the time type (Datetime,smalldatetime) and the string type (Nchar,nvarchar,char,varchar) are converted to each other. The 3 parameters of the function: The 1th argument is the converted large, the 2nd is the field or function of the converted date, and the 3rd is the conve
Label:Copy http://www.cnblogs.com/benwu/p/3939044.html The main description is that SQL Server uses convert to obtain datetime date data in the actual operation process, in the actual operation with the SQL Server database using convert to get datetime date data, the following instance contains a variety of date format conversions. Statements and Query results:
Select
Label:Format:CONVERT (Data_type,expression[,style])DescriptionThis style is typically in the time type (Datetime,smalldatetime) and the string type (Nchar,nvarchar,char,varchar)It is only used when converting to each other.Example:SELECT CONVERT (varchar (+), GETDATE (), 101) NowThe result is:Now---------------------------------------|09/15/2001===================================================================The style number has the following meanin
Use convert in SQL server2000 to get the datetime data type style (full)Processing of date data formats, two examples:CONVERT (varchar (16), time one, 20) results: 2007-02-01 08:02/* time is generally a field in the GETDATE () function or data table */CONVERT (varchar (10), time one, 23) Result: 2007-02-01/*varchar (10) represents the format of the date output, which can occur if not long enough */Statement
How to Use CONVERT:
Format:CONVERT (data_type, expression [, style])Note:This style is generally in the time type (datetime, smalldatetime) and string type (nchar, nvarchar, char, varchar)It is used only when they are converted to each other.Example:Select convert (varchar (30), getdate (), 101) nowResult:Now---------------------------------------09/15/2001
The meaning of the style number in the conversion
Let's look at the vocabulary method first The code is as follows:Copy code CONVERT (data_type (length), data_to_be_converted, style) Example 1 The code is as follows:Copy code Select convert (varchar (30), getdate (), 101) now Result:Now---------------------------------------| 03/8/2013Example 2 The code is as follows:Copy code 1> select CONVERT
How to use CONVERT :
////////////////////////////////////////////////////////////////////////////////////////
Format:CONVERT (Data_type,expression[,style])
DescriptionThis style is generally in the type of time (datetime,smalldatetime) and String type (Nchar,nvarchar,char,varchar)When they are converted to each other.
Example:SELECT CONVERT (varchar), GETDATE (), () nowResult isNow----------------------
Syntax format:CONVERT (Data_type,expression[,style])Description: This style is typically in time type (datetime,smalldatetime) and String type (Nchar,nvarchar,char,varchar)It is only used when converting to each other.Example:SELECT CONVERT (varchar (+), GETDATE (), 101) NowResult isNow---------------------------------------09/15/2001The style number has the following meaning when converting time: The style value that can be used.
Style
CONVERT (Data_type,expression[,style])CONVERT (varchar (10), field name, conversion format)
DescriptionThis style is generally in the type of time (datetime,smalldatetime) and String type (Nchar,nvarchar,char,varchar)When they are converted to each other.
Statement resultsSELECT CONVERT (varchar), GETDATE (), 0) 2009 4:06pmSELECT
This article mainly introduces the SQL time format output, convert function application, the need for friends can refer to the
This article mainly introduces the SQL time format output, convert function application, the need for friends can refer to the
Detailed references: Select CONVERT (varchar), GETDATE (), 0): 2006 10:57am
Select
Tags: lda convert lld date datetime reciprocal varchar res timeCONVERT (Data_type,expression[,style])CONVERT (varchar (10), field name, conversion format) DescriptionThis style is typically in the time type (Datetime,smalldatetime) and the string type (Nchar,nvarchar,char,varchar)It is only used when converting to each other. Statement resultSELECT CONVERT (varch
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.