根据多个可能的答案检查一个值或变量。
举例说明:
select [type],case [type]
when 'tt' then 'type_table'
when 'fn' then 'sql_scalar_function'
when 'c' then 'check_constraint'
when 'sq' then 'service_queue'
when 'f' then 'foreign_key_constraint'
when 'u' then 'user_table'
when 'd' then 'default_constraint'
when 'pk' then 'primary_key_constraint'
when 's' then 'system_table'
when 'it' then 'internal_table'
when 'p' then 'sql_stored_procedure'
when 'tf' then 'sql_table_valued_function'
when 'tr' then 'sql_trigger'
end as [type description]
from (
select distinct [type] from sys.objects
) o