0% found this document useful (0 votes)
54 views

P12 SQL Server Data Type Conversion Chart

The document shows a chart of implicit and explicit data type conversions allowed between SQL Server system-supplied data types. Implicit conversions occur without specifying CAST or CONVERT while explicit conversions require these functions. The chart displays all allowed conversions between data types.

Uploaded by

karthick raj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

P12 SQL Server Data Type Conversion Chart

The document shows a chart of implicit and explicit data type conversions allowed between SQL Server system-supplied data types. Implicit conversions occur without specifying CAST or CONVERT while explicit conversions require these functions. The chart displays all allowed conversions between data types.

Uploaded by

karthick raj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Data Type Conversion Chart

Implicit conversions are those conversions that occur without specifying either the CAST or CONVERT function.
Explicit conversions are those conversions that require the CAST or CONVERT function to be specified.
The following illustration shows all explicit and implicit data type conversions that are allowed for
SQL Server system-supplied data types.

To:

uniqueidentifier
datetimeoffset
smalldatetime

smallint(INT2)
tinyint(INT1)

smallmoney

hierarchyid
sql_variant
timestamp
datetime2
varbinary

datetime

int(INT4)
nvarchar

CLR UDT
numeric
decimal
varchar

money
binary

image
bigint
nchar

ntext
float
time
date
char

text
real

xml
bit
From:
binary
varbinary
char
varchar
nchar
nvarchar
datetime
smalldatetime
date
time
datetimeoffset
datetime2
decimal
numeric
float
real
bigint
int(INT4)
smallint(INT2)
tinyint(INT1)
money
smallmoney
bit
timestamp
uniqueidentifier
image
ntext
text
sql_variant
xml
CLR UDT
hierarchyid

Key:

Explicit conversion
Implicit conversion
Conversion not allowed
Requires explicit CAST to prevent the loss of precision or scale that might occur in an implicit conversion.
Implicit conversions between xml data types are supported only if the source or target is untyped xml. Otherwise, the conversion must be explicit.

© 2012 Microsoft Corporation. All rights reserved.


Email: [email protected]

You might also like