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 |
|
a4nsd
Starting Member
20 Posts |
Posted - 2007-01-12 : 22:57:21
|
| Hi everybody.Here's my Product fieldsID int,Title nvarchar(50),Price moneyHow can I get value from price field like thisIF PRICE is 12,000.00 it will display 12,000IF PRICE is 12,234.34 it will display 12,234.34Thanks very much...I am a beginner. Sorry for foolish question |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-01-13 : 04:48:46
|
[code]select value, replace(convert(varchar(20), value, 1), '.00', '')from ( select convert(money, 12000) as value union all select convert(money, 12234.34) as value ) v[/code]You might also want to consider doing the formatting in your front end application KH |
 |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2007-01-13 : 06:23:29
|
quote: Originally posted by khtan[brYou might also want to consider doing the formatting in your front end application KH
I agree with that.Also, take note. No question is "FOOLISH" Per se. Its a learning process |
 |
|
|
a4nsd
Starting Member
20 Posts |
Posted - 2007-01-13 : 21:03:38
|
| Thanks khtan for your reply.That is only two of my example. But when I have more than 2 records in my database. How can I get ? |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-01-14 : 02:09:01
|
[code]select value, replace(convert(varchar(20), value, 1), '.00', '')from yourtable[/code] KH |
 |
|
|
|
|
|
|
|