Precedence order for data types

SQL Server uses the following precedence order for data types:


Be careful while you define a DATA TYPE in sql. a little knowledge can make your query bit fast and optimized  


  • user-defined data types (highest)
  • sql_variant
  • xml
  • datetimeoffset
  • datetime2
  • datetime
  • smalldatetime
  • date
  • time
  • float
  • real
  • decimal
  • money
  • smallmoney
  • bigint
  • int
  • smallint
  • tinyint
  • bit
  • ntext
  • text
  • image
  • timestamp
  • uniqueidentifier
  • nvarchar (including nvarchar(max) )
  • nchar
  • varchar (including varchar(max) )
  • char
  • varbinary (including varbinary(max) )
  • binary (lowest)

Why we can't execute a stored procedure from a User Defined function(UDF)

Functions cannot "touch" any database but read them only. Stored procedures can do anything and everything with databases. You ...