set identity_insert tblindividual ON
insert into tblIndividual (nametitle, individ, lastname, firstname, occupation, employer, active, editor, creationdate)
select
salutation, idnumber, last_name, first_name, occupation,
employer, 1, recstatus, GETDATE()
from
i_master
where
cc_rectype = '1'
set identity_insert tblindividual OFF
Receiving error:
Msg 8152, Level 16, State 2, Line 2
String or binary data would be truncated. The statement has been terminated.
You're getting that error because one of the columns you are trying to insert data into is receiving data that is too large and would have to be truncated (cut short).
For example, if your nametitle field is a varchar(50) data type, but your salutation data was of type varchar(100) there could be values that will not fit without being truncated.
If you are happy to let your longer data be cut to size you can turn off the warning to allow the insert to continue using the statement:
SET ANSI_WARNINGS OFF;
-- Your insert TSQL here.
SET ANSI_WARNINGS ON;
As above, always remember to turn warnings back on again afterwards. I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With