CREATE function TL_getMode(@modeid nvarchar(100))
returns nvarchar(500)
as
begin
declare @re nvarchar(500)
set @re=''
if(@modeid!='')
begin
select @re=@re+ModeName+' ' from TL_Mode where charindex(','+cast(id as nvarchar(20))+',',','+@modeid+',')>0
if(@re!='')
begin
if(RIGHT(@re,1)=',')
select @re=left(@re, len(@re)-1)
end
else
set @re=''
end
else
set @re=''
return @re
end
不带世纪数位
(yy)
|
带世纪数位
(yyyy)
|
标准 |
输入 / 输出 ** |
-
|
0
或
100 (*)
|
默认值
|
mon dd yyyy hh:miAM
(或
PM
)
|
1
|
101
|
美国
|
mm/dd/yyyy
|
2
|
102
|
ANSI
|
yy.mm.dd
|
3
|
103
|
英国
/
法国
|
dd/mm/yy
|
4
|
104
|
德国
|
dd.mm.yy
|
5
|
105
|
意大利
|
dd-mm-yy
|
6
|
106
|
-
|
dd mon yy
|
7
|
107
|
-
|
mon dd, yy
|
8
|
108
|
-
|
hh:mm:ss
|
-
|
9
或
109 (*)
|
默认值
+
毫秒
|
mon dd yyyy hh:mi:ss:mmmAM
(或
PM
)
|
10
|
110
|
美国
|
mm-dd-yy
|
11
|
111
|
日本
|
yy/mm/dd
|
12
|
112
|
ISO
|
yymmdd
|
-
|
13
或
113 (*)
|
欧洲默认值
+
毫秒
|
dd mon yyyy hh:mm:ss:mmm(24h)
|
14
|
114
|
-
|
hh:mi:ss:mmm(24h)
|
-
|
20
或
120 (*)
|
ODBC
规范
|
yyyy-mm-dd hh:mm:ss[.fff]
|
-
|
21
或
121 (*)
|
ODBC
规范(带毫秒)
|
yyyy-mm-dd hh:mm:ss[.fff]
|
-
|
126(***)
|
ISO8601
|
yyyy-mm-dd Thh:mm:ss:mmm
(不含空格)
|
-
|
130*
|
科威特
|
dd mon yyyy hh:mi:ss:mmmAM
|
-
|
131*
|
科威特
|
dd/mm/yy hh:mi:ss:mmmAM
|
* 默认值(style 0 或 100、9 或 109、13 或 113、20 或 120、21 或 121)始终返回世纪数位 (yyyy)。
SQL Server 2005 Books Online (September 2007)
CAST and CONVERT (Transact-SQL)
Updated: 17 July 2006
Explicitly converts an expression of one data type to another. CAST and CONVERT provide similar functionality.
Transact-SQL Syntax Conventions
<script type="text/Javascript"> var ExpCollDivStr = ExpCollDivStr; ExpCollDivStr = ExpCollDivStr + "ctl00_LibFrame_ctl079c39139,"; var ExpCollImgStr = ExpCollImgStr; ExpCollImgStr = ExpCollImgStr + "ctl00_LibFrame_ctl07img,"; </script> Syntax
<script type="text/Javascript"> var ExpCollDivStr = ExpCollDivStr; ExpCollDivStr = ExpCollDivStr + "ctl00_LibFrame_ctl098bcac5c,"; var ExpCollImgStr = ExpCollImgStr; ExpCollImgStr = ExpCollImgStr + "ctl00_LibFrame_ctl09img,"; </script> Arguments
Is any valid expression.
data_type
Is the target system-supplied data type. This includes xml, bigint, and sql_variant. Alias data types cannot be used. For more information about available data types, see Data Types (Transact-SQL).
length
Is an optional parameter of nchar, nvarchar, char, varchar, binary, or varbinary data types. For CONVERT, if length is not specified, the default to 30 characters.
style
Is the style of the date format used to convert datetime or smalldatetime data to character data (nchar, nvarchar, char, varchar, nchar, or nvarchar data types), or to convert character data of known date or time formats to datetime or smalldatetime data; or the string format used to convert float, real, money, or smallmoney data to character data (nchar, nvarchar, char, varchar, nchar, or nvarchar data types). When style is NULL, the result returned is also NULL.
Note: |
The styles listed in this topic are supported by SQL Server in the described combinations with CONVERT target data types. All other styles and combinations are not supported. Do not use any unsupported styles. Using an unsupported style or an unsupported combination of style and target data type might return an error or unreliable results. These results are not guaranteed across releases of SQL Server. |
SQL Server supports the date format in Arabic style by using the Kuwaiti algorithm.
In the following table, the two columns on the left represent the style values for converting datetime or smalldatetime data to character data. Add 100 to a style value to obtain a four-place year that includes the century (yyyy).
Without century (yy) (1) |
With century (yyyy) |
Standard |
Input/Output (3) |
- |
0 or 100 (1, 2) |