qwas368
10/12/2018 - 9:44 AM

Find all the LOB Data Type Columns in a Database Using T-SQL Script

查詢資料庫中所有LOB data type


-- Find all the LOB Data Type Columns in a Database Using T-SQL Script
SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS 
WHERE DATA_TYPE IN ('FILESTREAM','XML','VARBINARY','TEXT','NTEXT','IMAGE') 
OR(DATA_TYPE IN ('VARCHAR', 'NVARCHAR') AND CHARACTER_MAXIMUM_LENGTH = -1)
ORDER BY TABLE_NAME