Select geral em todas as tabelas para saber tipos (decimal por ex)

17 de setembro de 2021   |   by administrador
SELECT 
SYS.TABLES.NAME AS TABLE_NAME ,
SYS.COLUMNS.NAME AS COLUMN_NAME,
SYS.TYPES.NAME AS TYPE_NAME,
SYS.TYPES.name + '(' + CAST(columns.precision AS VARCHAR(4)) + ',' + CAST(columns.scale AS VARCHAR(4)) + ')'
FROM SYS.TABLES
INNER JOIN SYS.COLUMNS ON SYS.COLUMNS.OBJECT_ID = SYS.TABLES.OBJECT_ID
INNER JOIN SYS.TYPES ON SYS.TYPES.SYSTEM_TYPE_ID = SYS.COLUMNS.SYSTEM_TYPE_ID
INNER JOIN SYS.SCHEMAS ON SYS.TABLES.SCHEMA_ID = SYS.SCHEMAS.SCHEMA_ID
WHERE 
SYS.SCHEMAS.NAME ='quali'
and SYS.TYPEs.name in('decimal','numeric','float')
Tags: