Comparing Column Definitions, want to avoid an 8152 or 8115 - Truncation of Data or Arithmetic Overflow
We have an ETL process that occasionally gets an 8152 truncation of data or an 8115 Arithmetic overflow because the Receiving field is not large enough to accommodate the sending data. I have been tasked with taking all of our staging tables and comparing the column sizes to the transformation table column sizes. I have the table built and populated with 4 values: Staging table name, column name, Transformation table name, column name.
I ran a query to compare the length, precision, scale and type of the two columns. But the differences were overwhelming. Now I just want to zero in on those column differences where the receiving column is small.
So do I care if the field types are different? Do I care that the destination is a VARCHAR and the source is a CHAR, or NUMERIC and DECIMAL? We only have data types decimal, numeric, varchar, char, datetime, int.
Thinking that I could have the following WHERE clause, would this pick up where the receiving field was smaller or do I have to be concerned with different types or some other column definition?
WHERE length_dest
< length_source or precision_dest
< precision_source or scale_dest
< scale_source
- Edited by TheBrenda 16 hours 6 minutes ago