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

decimal problem

Status
Not open for further replies.

phunkyb

Technical User
Dec 30, 2003
14
0
0
AU
hello everyone,
whenever i insert data into my decimal column the value is different from what i wanted. like when i enter -17.5 the value goes in entered as -9. My decimal type is entered as (1,0). I just want it to be one decimal place and to betered in as what i want.
Also i was wondering how auto_increment works. when i enter data, do i leave the column out.
Thankyou for your help.
 
you can either use 0 during insertion as the value for the auto_increment field, or specify the column names of other data you are inserting, it should be automatically numbered.
The decimal problem: i think the first digit specifies the total number of digits, and the last the number of decimal places try (3,1) for your kind of data
 
Indeed the first digit is the total number of digits and the last is the decimal.

ABout auto_increment is always good to not enter anything as some scripting languages such as ASP may fail in inserting any value into a auto_increment field.

So a ('', 'value1', 'value2'...) is a safer way to go.

Bye

Qatqat

Life is what happens when you are making other plans.
 
i tried what you said with auto_increment but it gives error. This is how i entered it.
insert into game table values (
,'2003-3-28','1','61058','col','ric','mcg','-17.5','17.5');
The first number is meant to be the auto increment(ie the on before 2003-3-28).
Thanks
 
If you don't supply values for all columns in an insert statement you need to specify which columns.

Code:
insert into game table values (c1,c2,c3,c4,c5,c6,c7,c8)
'2003-3-28','1','61058','col','ric','mcg','-17.5','17.5')
 
Definitely I was assuming that all values were supplied.

Bye

Qatqat

Life is what happens when you are making other plans.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top