查询数据库中含有某一数据类型列的表名
比如说我想查询我数据库中所有列类型为text的列名和所对应的表
求帮忙
[解决办法]
Select C.NAME As ObjName, A.Name As FldName, B.Name As TypeName, A.Length From SYSCOLUMNS A Inner Join SYSTYPES B On A.xtype = B.xtype Inner Join SYSOBJECTS C ON A.ID = C.ID Where C.xtype = 'U' And B.Name = 'Text'
[解决办法]
select b.name as Tab,a.name as Col,a.max_length as Len from sys.columns a inner join sys.tables b on a.object_id = b.object_idinner join sys.types c on a.system_type_id = c.system_type_id and c.name <>'sysname'where c.name = 'text'
[解决办法]
SELECT OBJECT_NAME([object_id]) AS table_name ,name AS column_nameFROM sys.columns WHERE system_type_id=TYPE_ID('text')