I want to find out the table list with column, which column datatype has tinyint. So that i want to replace tinyint to int in Database. Here is given a simple SQL query which has find out the table list with column.
SELECT OBJECT_NAME(c.OBJECT_ID) TableName, c.name ColumnName
FROM sys.columns AS c
JOIN sys.types AS t ON c.user_type_id=t.user_type_id
Join Sys.objects AS o on o.object_id = c.object_id
WHERE t.name = ‘TINYINT’ AND o.type in (‘U’,‘P’,‘FN’,‘V’,‘TR’)
ORDER BY o.type, c.OBJECT_ID;
Select * from Sys.columns
Select * from Sys.types
Select distinct TYPE, type_desc from Sys.objects
Leave a comment