|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi Everyone,
I am having a problem with mysql, when using convert. I have version 5.0.45 of mysql, the problem I am having is if I run a query as follows, after the insert queries: insert into testing (value,value2) values ('3.68','7.22'); insert into testing (value,value2) values ('1.21','5.79'); select convert(value,DECIMAL),convert(value2,DECIMAL) FROM testing; I get the following, where I would expect to get the same values that were entered with the insert query commands: +------------------------+-------------------------+ | convert(value,DECIMAL) | convert(value2,DECIMAL) | +------------------------+-------------------------+ | 1 | 6 | | 4 | 7 | +------------------------+-------------------------+ 2 rows in set (0.00 sec) I am having this problem after moving the production database to this new server, where the old was not rounding the values to the nearest integer. Could anyone give me some assistance to what might be the cause? I am not very familiar with configuring MySQL, but have full access to the configuration files etc. Thanks, David |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
== Quote from dkruger (davidkruger@techie.com)'s article
> Hi Everyone, > I am having a problem with mysql, when using convert. I have version > 5.0.45 of mysql, the problem I am having is if I run a query as > follows, after the insert queries: > insert into testing (value,value2) values ('3.68','7.22'); > insert into testing (value,value2) values ('1.21','5.79'); > select convert(value,DECIMAL),convert(value2,DECIMAL) FROM testing; > I get the following, where I would expect to get the same values that > were entered with the insert query commands: > +------------------------+-------------------------+ > | convert(value,DECIMAL) | convert(value2,DECIMAL) | > +------------------------+-------------------------+ > | 1 | 6 | > | 4 | 7 | > +------------------------+-------------------------+ > 2 rows in set (0.00 sec) > I am having this problem after moving the production database to this > new server, where the old was not rounding the values to the nearest > integer. > Could anyone give me some assistance to what might be the cause? I am > not very familiar with configuring MySQL, but have full access to the > configuration files etc. > Thanks, > David post a description of the table. run this from cmd line: desc tablename; and post the results. -- POST BY: lark with PHP News Reader ;o) |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Oct 17, 3:15 pm, lark <ham...@sbcglobal.net> wrote:
> == Quote from dkruger (davidkru...@techie.com)'s article > > > > > > > Hi Everyone, > > I am having a problem with mysql, when using convert. I have version > > 5.0.45 of mysql, the problem I am having is if I run a query as > > follows, after the insert queries: > > insert into testing (value,value2) values ('3.68','7.22'); > > insert into testing (value,value2) values ('1.21','5.79'); > > select convert(value,DECIMAL),convert(value2,DECIMAL) FROM testing; > > I get the following, where I would expect to get the same values that > > were entered with the insert query commands: > > +------------------------+-------------------------+ > > | convert(value,DECIMAL) | convert(value2,DECIMAL) | > > +------------------------+-------------------------+ > > | 1 | 6 | > > | 4 | 7 | > > +------------------------+-------------------------+ > > 2 rows in set (0.00 sec) > > I am having this problem after moving the production database to this > > new server, where the old was not rounding the values to the nearest > > integer. > > Could anyone give me some assistance to what might be the cause? I am > > not very familiar with configuring MySQL, but have full access to the > > configuration files etc. > > Thanks, > > David > > post a description of the table. run this from cmd line: > > desc tablename; > > and post the results. > > -- > POST BY: lark with PHP News Reader ;o)- Hide quoted text - > > - Show quoted text - I did get my problem resolved, ended up just changing my php programming mysql queries to not use convert, and took care of changing to decimal in php instead. The value and value2 columns are blob types in the production table, but it had previously worked with the convert to decimal without rounding them on the old server, which was puzzling. but since I have a work around that works, all is well. Thanks! |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
"dkruger" <davidkruger@techie.com> schreef in bericht news:1192654309.986558.143930@z24g2000prh.googlegr oups.com... > On Oct 17, 3:15 pm, lark <ham...@sbcglobal.net> wrote: >> == Quote from dkruger (davidkru...@techie.com)'s article >> >> >> >> >> >> > Hi Everyone, >> > I am having a problem with mysql, when using convert. I have version >> > 5.0.45 of mysql, the problem I am having is if I run a query as >> > follows, after the insert queries: >> > insert into testing (value,value2) values ('3.68','7.22'); >> > insert into testing (value,value2) values ('1.21','5.79'); >> > select convert(value,DECIMAL),convert(value2,DECIMAL) FROM testing; >> > I get the following, where I would expect to get the same values that >> > were entered with the insert query commands: >> > +------------------------+-------------------------+ >> > | convert(value,DECIMAL) | convert(value2,DECIMAL) | >> > +------------------------+-------------------------+ >> > | 1 | 6 | >> > | 4 | 7 | >> > +------------------------+-------------------------+ >> > 2 rows in set (0.00 sec) >> > I am having this problem after moving the production database to this >> > new server, where the old was not rounding the values to the nearest >> > integer. >> > Could anyone give me some assistance to what might be the cause? I am >> > not very familiar with configuring MySQL, but have full access to the >> > configuration files etc. >> > Thanks, >> > David >> >> post a description of the table. run this from cmd line: >> >> desc tablename; >> >> and post the results. >> >> -- >> POST BY: lark with PHP News Reader ;o)- Hide quoted text - >> >> - Show quoted text - > > I did get my problem resolved, ended up just changing my php > programming mysql queries to not use convert, and took care of > changing to decimal in php instead. The value and value2 columns are > blob types in the production table, but it had previously worked with > the convert to decimal without rounding them on the old server, which > was puzzling. but since I have a work around that works, all is well. > > Thanks! > i think the output of: select 2/3 is different on your 'old server' and your 'production server' ?? i has sometheing to do with the decimail "." or the decimal "," ....(my guess) |
|
![]() |
| Outils de la discussion | |
|
|