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

errors in inserting values to table

Status
Not open for further replies.

qtshyne

MIS
Jul 14, 2001
1
CA
i got this error when i tried inserting values to my tables. please help me!!!! thanks a lot..

Server: Msg 8152, Level 16, State 9, Line 1
String or binary data would be truncated.
The statement has been terminated.
 

This behavior is by design. SQL Server 7 and 2000 will fail with this error message if the data (string or binary) being inserted into a column is too long for the column. Previous versions of SQL Server truncated and inserted the data without any warning.

You'll need to determine which data values are too long and trim them or make the columns wider. Terry Broadbent
Please review faq183-874.

"The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge." - Daniel J Boorstin
 
The Value you are trying to Insert into the table is larger than the field size in the table.

Example:
create table #temp1
(
Test char(1)
)
go
Insert into #temp1 values('12')
go
drop table #temp1

In the above script, The field Test cannot hold more than one character of data. So when u try to insert 2 characters SQL Server will return a error.

So either Increase the field size or decrease the size of the value inserted.


dbtech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top