Has someone ran into something strange like this where no data is being inserted but this error happens.Msg 8152, Level 16, State 14, Line 1String or binary data would be truncated.In our production environment there is a Temp table created where "id" column is defined as varchar(15)along with other columns defined. There is a large query 5 table join ...that "inserts" into the temp table.There is a table part of the large query that has a column called table1.ID to simplify. Looking at the defined column. "table1.id" is defined as char(25)** I didn't write the code, it's odd even how it was implemented. Anyhow recently developers mentioned an ssis job had been failiing..(only recently past 4 days... we checked the data and we've had records in the system last month with character size more than 15 so maybe not a data issue... could it be data corruption or maybe I'm just missing something) he found the fix, but it requires changing it to "varchar(25)" in the TEMP Table.. but I'm still stumped at the reason why it fails. Wanted to ask if someone could help explain. The actual query is joining about 5 tables.Psuedo code:insert into #TEMPTTABLEselect columns join table1 join table2 join table3 join table4 join table5Where Some Criteria= SUCCESS (500,000 records inserted)insert into #TEMPTTABLEselect columns join table1 join table2 join table3 join table4 join table5Where Some Criteria AND len(ID) > 15 -- insert records > 15 characters in length= FAILED ERROR "String or binary data would be truncated."Let's find the suspect records select columns join table1 join table2 join table3 join table4 join table5Where Some Criteria AND len(ID) > 15 -- insert records > 15 characters in length= RESULTS RETURNED ZERO ROWS... I thought that was oddSo in summary:An insert into yielded with the multi-table join = works, inserts recordsAn insert into yielded with the multi-table join adding criteria records > 15 char = Fails error msg.A "select" to research suspect records with id's > 15 ... using the mult-table join (omitting the Insert #TEMPTABLE) but adding criteria records > 15 = Returns NO records... but fails to insert (0 records - since the select yields zero records) when combined with #TEMPTABLE insert.... but displays error msg:Any thoughts?
↧
String or binary data would be truncated. Error when inserting empty table results into TEMP table
↧