Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error: String or binary data would be truncated.??

Status
Not open for further replies.

stewglyn

Programmer
Apr 4, 2002
9
0
0
GB
On an Identity primary key column, when I try to insert records from tableA to tableB, I get the truncated data error. The datatypes of the destination column and the source are the same datatype - int (4) Help??
 
Are you only inserting into one column? The error is an ANSI warning that the insertion would result in truncated data in a column. This doesn't apply to integer columns so you must have other columns in the insert statement. One or more columns in the source table is longer than the corresponding column in the destination table.

If you don't care about losing data by truncation, you can run the following command before running the Insert statement. This will turn off he ANSI warning, the data will be truncated and inserted.

SET ANSI_WARNINGS OFF Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Ah, thanks,I didn'know it was an ansi warning, The Identity field is an Int (4) primary key field. I'm actually appending data and changing the datatypes with cast and convert, the majority of them I'm moving the size of the varchar down to (20) from (50). But I'll experiment with killing the warning.

ta.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top