SQL: Compare the columns data types of two different tables

Often using SQL we need to compare the data types of the columns of two different tables. For example, when we bring the data from the Stage to the data warehouse, or if we have to put into union two tables with similar data.

When this happens, more often in error or distraction it appears there the usual generic error in the case in which the types of the two data tables are incorrect.

is very difficult to identify where the error is because sql does not show the column, I wrote this simple script that allows you to identify the error:

Continua a leggere