日期:2014-05-17  浏览次数:20479 次

如何获取字段类型
比如我有一个表tbl
其中有个字段col1,类型为float,
现在我要获取表tbl中字段col1的类型,返回float

怎么写sql

------解决方案--------------------
函数?
------解决方案--------------------
看看下面的程序,你可能就知道了:
create table tb(a int,b float,c decimal(10,2),d varchar(10))
go
select name,system_type_id from sys.columns where object_id=object_id('tb')
/*
name                                                                                                                             system_type_id
-------------------------------------------------------------------------------------------------------------------------------- --------------
a                                                                                                                                56
b                                                                                                                                62
c