SQL Server check resultant data type of expression

后端 未结 3 746
时光说笑
时光说笑 2020-12-13 06:14

Normally I would put the data type into a temp table and inspect the table column type, e.g.

select 1.0 N into tbl

sp_help tbl

Column N th

3条回答
  •  天涯浪人
    2020-12-13 06:46

    All that I can think of are the ISNUMERIC and ISDATE functions.

    These will return a 1/0 when passed an expression. I can't think of anything that will return the type if given an expression unfortunately.

    UPDATE:

    Try SQL_VARIANT_PROPERTY! I think this is what you are looking for. Hard to track down...

提交回复
热议问题