Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2005
 Data Type Precedence (Transact-SQL)

  Switch on low bandwidth view
Community Content
In this section
Statistics Annotations (0)
SQL Server 2005 Books Online (November 2008)
Data Type Precedence (Transact-SQL)

When an operator combines two expressions of different data types, the rules for data type precedence specify that the data type with the lower precedence is converted to the data type with the higher precedence. If the conversion is not a supported implicit conversion, an error is returned. When both operand expressions have the same data type, the result of the operation has that data type.

SQL Server 2005 uses the following precedence order for data types:

  1. user-defined data types (highest)
  2. sql_variant
  3. xml
  4. datetime
  5. smalldatetime
  6. float
  7. real
  8. decimal
  9. money
  10. smallmoney
  11. bigint
  12. int
  13. smallint
  14. tinyint
  15. bit
  16. ntext
  17. text
  18. image
  19. timestamp
  20. uniqueidentifier
  21. nvarchar (including nvarchar(max) )
  22. nchar
  23. varchar (including varchar(max) )
  24. char
  25. varbinary (including varbinary(max) )
  26. binary (lowest)
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker