Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Insert query

Author  Topic 

poornima
Starting Member

32 Posts

Posted - 2006-11-11 : 02:02:41
Hello
I have a table consisting of Date,Particulars,Debit,Credit columns.I executed the following query to insert the values.

insert into balancesheet(Particulars,Credit) VALUES('Salary',4917.00)

Iam getting an error

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

Plz help me out

Thanks in advance
Poornima

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-11-11 : 02:27:52
quote:
String or binary data would be truncated


You get this Error, when you are trying to insert the values in the column which is greater then the field size defined into the table.

what is the field size of the column Particulars?

Are there any trigger on the table, through which you inserting the records in the some other secondary table?



Chirag

http://chirikworld.blogspot.com/
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-11-11 : 03:33:00
Can't really help unless you provide the DDL for the table balancesheet please.

In particular what is the datatype of Particulars and Credit?

Most probably one of those two columns is too "narrow" for the data you are trying to store. But it could be a host of other things which the DDL would reveal.

Kristen
Go to Top of Page

poornima
Starting Member

32 Posts

Posted - 2006-11-11 : 05:35:12
thank you.I got the problem solved.I did not mention the size of varchar ,the datatype of Particulars
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-12 : 20:12:52
quote:
Originally posted by poornima

thank you.I got the problem solved.I did not mention the size of varchar ,the datatype of Particulars


If you dont specify the column size, it is considered as 1. You should always define the size

Declare @s varchar
Set @s='Test'
Select @s


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -