Data Type Conversion Chart - Amazon Web Services · SQL Server system-supplied data types. binary...

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. 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 binary char nchar nvarchar datetime date datetime2 numeric float bigint int(INT4) smallint(INT2) real varbinary varchar smalldatetime datetimeoffset decimal To: From: Key: smallmoney money image tinyint(INT1) bit timestamp uniqueidentifier time ntext text sql_variant xml CLR UDT hierarchyid 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]

Transcript of Data Type Conversion Chart - Amazon Web Services · SQL Server system-supplied data types. binary...

Page 1: Data Type Conversion Chart - Amazon Web Services · SQL Server system-supplied data types. binary varbinary char varchar nchar nvarchar datetime smalldatetime date time datetimeoffset

Max art width 450 pixels

Prefered max art height 580 pixels

Too Big 450 x 800

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.

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

bina

ry

char

ncha

r

nvar

char

date

time

date

date

time2

num

eric

float

bigi

nt

int(I

NT4)

small

int(I

NT2)

real

varb

inar

y

varch

ar

small

date

time

date

timeo

ffset

decim

al

To:

From:

Key:

small

mon

ey

mon

ey

imag

e

tinyin

t(INT

1)

bit

times

tam

p

uniq

ueid

entif

ier

time

ntex

t

text

sql_v

arian

t

xml

CLR

UDT

hier

arch

yid

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]