:::: MENU ::::

union for different data types in T-SQL

  • Jan 07 / 2010
  • 0
dbDigger, T-SQL Interview Questions

union for different data types in T-SQL

What happens with this code?

select ‘B’


select 4

Answer: The varchar is converted in int (error results)

Explanation: This is an example of an implicit conversion in T-SQL. In this case, an error is returned as the varchar is converted to an int, or an attempt is made, which returns an error. The int is of higher precedence than a varchar, so that is the order of conversions.

Note: The question of day is taken from SqlServerCentral.com. I want to compile selected QOD to share.

Consult us to explore the Databases. Contact us