本文主要是介绍获取SQL Server指定表中的字段类型和长度,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
获取SQL Server指定表中的字段类型和长度
SELECT T_JB.name AS F_NAME,T_JB2.DATA_TYPE AS F_DATA_TYPE,T_JB.prec AS F_ZS,T_JB.scale AS F_XS,T_JB2.F_ENGLISH,T_JB2.F_CHINESE
FROM
(SELECT name,prec,ISNULL(scale, 0) AS scaleFROM syscolumnsWHERE id = OBJECT_ID('T_BOMMaster')
) AS T_JBLEFT OUTER JOIN(SELECT COLUMN_NAME,DATA_TYPE,ISNULL(CHARACTER_MAXIMUM_LENGTH, 0) AS F_ENGLISH,ISNULL(CHARACTER_OCTET_LENGTH, 0) AS F_CHINESEFROM INFORMATION_SCHEMA.COLUMNSWHERE TABLE_NAME = 'T_BOMMaster') AS T_JB2ON T_JB.name = T_JB2.COLUMN_NAME;
这篇关于获取SQL Server指定表中的字段类型和长度的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!