我想找到DECIMAL作为数据类型的一列的numeric_precision和numeric_scale。
我试过了
SELECT DATA_TYPE, COLUMN_name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'X'
但这只会给我“十进制”
您可以查询系统视图information_schema.columns
。我认为您正在寻找专栏numeric_precision
和numeric_scale
select numeric_precision, numeric_scale
from information_schema.columns
where table_schema = ? and table_name = ? and column_name = ?
create table t (col decimal(10, 2));
select numeric_precision, numeric_scale
from information_schema.columns
where table_schema = 'dbo' and table_name = 't' and column_name = 'col'
数字精度| numeric_scale :---------------- | ------------: 10 | 2
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句