Select that shows all tables that have fields with specific data type

4

I have a database that I need to change all the columns that are in FLOAT and DOUBLE to DECIMAL, are about 150 tables and I spend a lot of time looking one by one, is there any command that shows me this?

MY SQL database, use 6.3 workbench

Thank you.

    
asked by anonymous 21.07.2016 / 16:16

1 answer

4

Wonder, I found what I needed: D

Follow the code:

SELECT 
    *
FROM
    information_schema.COLUMNS
WHERE
    1 = 1
        AND TABLE_SCHEMA = 'nome_do_meu_banco_de_dados'
        AND (DATA_TYPE = 'FLOAT'
        OR DATA_TYPE = 'DOUBLE')

I found this link: link

Thank you.

    
21.07.2016 / 16:35