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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String or binary data would be truncated. Never seen this problem.

Status
Not open for further replies.

rajpree

Programmer
May 24, 2005
18
0
0
US
I am getting following error. I under stand this error message. But in my case I am not able identify the problem.

String or binary data would be truncated.
The statement has been terminated.

My table:
test
(t1 char(4),
t2 char(4)
)

Insert statement:
insert into rpt_rating_distribution_map
(t1, t2)
values
('RR','BB')

If I am using SET ANSI_WARNINGS OFF and running insert statement then it is inserting successful.

Does any one have idea why am I getting error.

Thanks,
RajPree
 
You are doing nothing wrong, your SQL statements are correct.

What product are you using? Maybe you should ask your question in a vendor specific forum.
 
Your code looks fine. Normally this means that the data you are trying to put into the table is bigger than the field allows.

Other than you insert statement isn't going to your test table, I've got no idea why you are getting this error.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
I using SQL Query Analyzer and this is SQL Server 2000. Hopes this helps.
 
You showed the schema of a table named test but what about rpt_rating_distribution_map ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry for that : I mean rename table.

My table:
test
(t1 char(4),
t2 char(4)
)

Insert statement:
insert into test
(t1, t2)
values
('RR','BB')

 
As others have said, there is nothing wrong with that code (I even tried it to make sure). ANSI_WARNINGS setting doesn't make any difference - it works fine.

Are you sure that is the actual code you are running??

--James
 
Yes, I am sure one more interesting point is same insert statement one of my co worker is running and she is able to run without any errors.
 
Try recreating the table:

Code:
DROP TABLE test

CREATE TABLE test (
  t1 char(4),
  t2 char(4)
)

INSERT test VALUES ('RR', 'BB')

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top