inserting decimal values failing

Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jul 2008
Posts: 25
Reputation: stockton is an unknown quantity at this point 
Solved Threads: 0
stockton stockton is offline Offline
Light Poster

inserting decimal values failing

 
0
  #1
Sep 12th, 2008
I have setup the following table:-
  1. IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
  2. WHERE TABLE_NAME = 'TlHold')
  3. DROP TABLE THold
  4. GO
  5. CREATE TABLE THold (
  6. pid int NOT NULL IDENTITY(1,1),
  7. TS NUMERIC(2,2) NOT NULL,
  8. TR NUMERIC(2,2) NOT NULL,
  9. TB NUMERIC(2,2) NOT NULL,
  10. TP NUMERIC(2,2) NOT NULL,
  11. TP2 NUMERIC(2,2) NOT NULL,
  12. filler1 NUMERIC(2,2) NOT NULL,
  13. filler2 NUMERIC(2,2) NOT NULL,
  14. filler3 NUMERIC(2,2) NOT NULL,
  15. PRIMARY KEY (pid)
  16. );

and now I am trying to execute the following insert statement in Enterprise Manager

  1. INSERT INTO THold VALUES (5.40, 2.40, 1.00, 1.15, 2.40, 0,0,0);

and it fails with
Server: Msg 8115, Level 16, State 8, Line 1
Arithmetic overflow error converting numeric to data type numeric.
The statement has been terminated.

I do not understand the necessity of converting numeric to numeric.
Please tell me what I have done wrong.
Last edited by stockton; Sep 12th, 2008 at 11:58 am. Reason: misspelling
Regards,
Alf Stockton www.stockton.co.za
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,160
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 137
dickersonka dickersonka is offline Offline
Veteran Poster

Re: inserting decimal values failing

 
0
  #2
Sep 12th, 2008
your total digits on each column is 2

also use columns when inserting
  1. INSERT INTO theoritcalHold (TS, TR, ...etc) VALUES(.....)
Last edited by dickersonka; Sep 12th, 2008 at 12:04 pm.
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 25
Reputation: stockton is an unknown quantity at this point 
Solved Threads: 0
stockton stockton is offline Offline
Light Poster

Re: inserting decimal values failing

 
1
  #3
Sep 12th, 2008
definition of fields is wrong at 2,2 should be at lease 3,2
Regards,
Alf Stockton www.stockton.co.za
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC