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 |
elic05
Yak Posting Veteran
62 Posts |
Posted - 2009-07-26 : 10:47:32
|
the dataType for the price cell is smallmoneyon the local host it behaves fineif i insert the value 2.25 in the table i fine the exact numberbut on the remore serveri see in the table2.2500always 4 digits after the decimal point.why??can it be fixed, that it will get the exact number i insert?the second questionhow to write a query that will delete all the trailing zeroes(sometime it has to delete also the point e.g. 5.0000 has to be 5)thanks |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-07-26 : 11:36:47
|
This makes no sense to me.It is the job of the database to store the data in the right format depending on the datatype and not depending of any format you want to display.You should do that kind of formatting in your front end. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
elic05
Yak Posting Veteran
62 Posts |
Posted - 2009-07-26 : 12:29:30
|
i dont no if it make sense, but it is the facti insert data (e.g. 2.25) to the table using the same queryon the local machin i see in the table 2.25and on the remote server i see 2.2500it nust be somthing with the DB definitions.and what about the second question?a query to change the already inserted data? |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-07-26 : 13:39:35
|
quote: it nust be somthing with the DB definitions
No, it must be something with the client config.quote: and what about the second question?a query to change the already inserted data?
Believe it or not. SQL Server has its internal format for the datatype and there is NO update to change the data because it is in fact a display-problem not a data-problem. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
elic05
Yak Posting Veteran
62 Posts |
Posted - 2009-07-26 : 16:27:48
|
even more ineresting!when i open the remote database with mssmse i see in the table that all the price column is formatted with 4 digits after the decimal period.but when i query the db select price from myProductsi get all the prices with only 2 digits after the decimal period. |
 |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2009-07-26 : 18:01:16
|
2.25 and 2.2500 are the same thing. do the formatting in the front end (as webfred said) |
 |
|
|
|
|