This is a lightweight check (metadata only) that will narrow your search down to the list of columns that might causing the issue -
the columns where the max_length in the target table is smaller than the the max_length of the matching expression in the source query.
Create an empty table based on the results of your source query and compare metadata.
Example:
create table src (str1 varchar(11),str2 varchar(3));
create table trg (str1 varchar(7),str2 varchar(3));
insert into src values ('Hi','XY'),('Hello world','XY'),('Hi','XYZ')
insert into trg (str1,str2) select str1,str2 + 'D' from src
Msg 8152, Level 16, State 14, Line 10
String or binary data would betruncated.
select str1,str2+'D' as str2 into tmp from src where 1=2;
select *
from (select c.name
,min(case o.name when 'tmp' then t.name end) as tmp_type
,min(case o.name when 'trg' then t.name end) as trg_type
,min(case o.name when 'tmp' then c.max_length end) as tmp_max_length
,min(case o.name when 'trg' then c.max_length end) as trg_max_length
from sys.objects as o
join sys.columns as c
on c.object_id = o.object_id
join sys.types as t
on t.system_type_id = c.system_type_id
and t.user_type_id = c.user_type_id
where o.name in ('tmp','trg')
and ( c.collation_name is not null
or c.name in ('binary','varbinary')
)
group by c.name
) c
where tmp_max_length > trg_max_length
order by c.name
;
+------+----------+----------+----------------+----------------+
| name | tmp_type | trg_type | tmp_max_length | trg_max_length |
+------+----------+----------+----------------+----------------+
| str1 | varchar | varchar | 11 | 7 |
+------+----------+----------+----------------+----------------+
| str2 | varchar | varchar | 4 | 3 |
+------+----------+----------+----------------+----------------+