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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-11-29 : 05:08:52
|
| Wendy writes "How do I query a number $155000 to display as $155,000? I am using the following query:SELECT city, '$' + CAST(curprice as VARCHAR(10)) Price FROM propmainWhich displays:city Price-------- -----------Dallas $155000Thank You!Wendy" |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-11-29 : 05:19:08
|
curprice must be of type money or smallmoney:SELECT city, '$' + convert(VARCHAR(10), curprice, 1) as Price FROM propmainGo with the flow & have fun! Else fight the flow |
 |
|
|
scamperbunny
Starting Member
1 Post |
Posted - 2004-11-30 : 23:39:27
|
The following does not work. I did not create the DB. I can only query data from the DB. Any other suggestions on how to format a number from $155000 to $155,000?quote: Originally posted by spirit1 curprice must be of type money or smallmoney:SELECT city, '$' + convert(VARCHAR(10), curprice, 1) as Price FROM propmainGo with the flow & have fun! Else fight the flow 
|
 |
|
|
rockmoose
SQL Natt Alfen
3279 Posts |
Posted - 2004-12-01 : 01:41:08
|
| As Spirit said, the datatype has to be money for the formatting to work.select '$'+convert(varchar,cast(155000 as money),1)Ususally the take is:the database serves the data, the client formats the data.rockmoose |
 |
|
|
|
|
|
|
|