Data Conversion
SQL
Server often cast data type with lower precedence to a data type with higher
precedence.
Example: 2 + '2' = 4 because '2' is converted to an
integer. Since an INT data type has higher precedence than a CHAR.
Data Type Precedence
of some data type
User-defined
(highest)
Xml
Datetime2
Datetime
Smalldatetime
Date
Time
Float
Real
Decimal
Money
Smallmoney
Bigint
Int
Smallint
Tinyint
Bit
Timestamp
Uniqueidentifier
Nvarchar
Nchar
Varchar
Char
Varbinary
Binary
(lowest)
BOL Data type
Precedence: http://msdn.microsoft.com/en-us/library/ms190309.aspx
Microsoft 70-461 Training Kit
No comments:
Post a Comment