0 Replies - 2229 Views - Last Post: 18 March 2013 - 02:42 AM Rate Topic: -----

#1 toad87  Icon User is offline

  • D.I.C Head

Reputation: 8
  • View blog
  • Posts: 188
  • Joined: 21-May 12

Getting that truncated error...

Posted 18 March 2013 - 02:42 AM

"String or binary data would be truncated."

Hi guys. I'm writing a Java program using MS SQL.

Here is my SQL Code for one table:

CREATE TABLE a00753665_Items(Item_Sku VARCHAR(20), Description VARCHAR(80), Price FLOAT, Discount FLOAT, PRIMARY KEY(Item_Sku))



INSERT INTO %s VALUES('%s', '%s', '%.2f', '%.2f')", ITEM_TABLE_NAME, item.getProductNumber(), item.getDescription(), item.getPrice(), item.getDiscount())



This is the data that should be getting inserted:

Tassimo T46 Home Brewing System
43-0439-6
179.99
0.30

Moto Precise Fit Rear Wiper Blade
0210919
799
0.0

Easton Stealth Reflex Composite Hockey Stick
83-4567-0
89.99
0.5

Yardworks 4-Ton Log Splitter
60-3823-0
399.99
0


The table is created fine. But the inserts are giving me that error.

Data is taken from an Item object with these variables:

private String productNumber;
private String description;
private double price;
private double salePrice;

Any help is appreciated...My brain is tired..I think I just need someone else to take a look at it.

Thanks

After reading my post, I figured it out...I transposed the first and second columns of data....

Thanks guys!@

Is This A Good Question/Topic? 0
  • +

Page 1 of 1