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.
| Author |
Topic |
|
cathymomo
Starting Member
10 Posts |
Posted - 2009-03-09 : 10:51:29
|
| Hi All,Well this is my table:7)create table ExpenseItem(EINo integer not null IDENTITY, ExpDesc varchar(255) not null,ExpenseDate datetime DEFAULT GETDATE() not null,ExpAmt money DEFAULT '0' not null,ExpApprAmt money DEFAULT '0',ERNo integer not null,ECNo integer not null,AssetNo integer,CONSTRAINT ExpApprAmt CHECK (ExpApprAmt<=ExpAmt),PRIMARY KEY (EINo),FOREIGN KEY (ERNo) REFERENCES ExpenseReport ON DELETE CASCADE,FOREIGN KEY (ECNo) REFERENCES ExpCat,FOREIGN KEY (AssetNo) REFERENCES Asset ON DELETE SET NULL );And this is a sample INSERT Statement:INSERT INTO ExpenseItem(ExpDesc, ExpenseDate,ExpAmt, ExpApprAmt, ERNo, ECNo, AssetNo)VALUES ('Hilton','8/9/2002',99.00,99.00,1,7,NULL);I keep getting Truncate Errors, can anybody spot my problem please?? |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-09 : 10:58:42
|
| Don't you mean string truncation ? Check for the length of the fields defined in the table and that you are inserting. Whats the defined length of ExpDesc. |
 |
|
|
cathymomo
Starting Member
10 Posts |
Posted - 2009-03-09 : 11:12:28
|
| Ya sorry, its a string truncate. I don't know is it maybe something to do with the data/time, as in other tables I also have varchar(..) and similar data being inserted and they work fine. |
 |
|
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2009-03-09 : 11:15:01
|
| You are inserting values which have length more than that defined on the table. Hence some part of it gets truncated, trimmed if you like. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-10 : 02:47:18
|
| I dont think you will get truncation error in code you posted as you've only a single character data field which has length of 255 and you've populating it with small value. does you table ExpenseItem have any insert trigger? if yes, check which table trigger is populating data with and check lengths of string fields and see if they have sufficient lengths |
 |
|
|
davewalsh89
Starting Member
2 Posts |
Posted - 2011-03-31 : 17:30:20
|
| Hi cathymomo, Im working on the same project as you but im lost, is there anyway I could contact you for some help? if so please reply to this post |
 |
|
|
|
|
|
|
|