SQL根據列值查詢表

select distinct
'select distinct ' '' + tab. name + '.' + col. name
+ '' '    from [' + tab. name
+ '] where [' + col. name + '] like ' '%電話呼叫%' ' union '
from sys.tables tab
join sys.columns col on (tab. object_id = col. object_id)
join sys.types types on (col.system_type_id = types.system_type_id)
where tab.type_desc = 'USER_TABLE'
and types. name IN ( 'CHAR', 'NCHAR', 'VARCHAR', 'NVARCHAR');
相關文章
相關標籤/搜索