例如,如何检查sql Server表中的列是否为数据类型char(11)?
select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where DATA_TYPE = 'char' and CHARACTER_MAXIMUM_LENGTH = 11 and TABLE_NAME = 'your_table'
使用syscolumns:
SELECT name FROM SYSCOLUMNS where length = 11 and xtype = 175 --char type