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 |
blackX
Posting Yak Master
102 Posts |
Posted - 2008-01-08 : 14:25:11
|
Hello again, I got another question. I have the following statementSELECT top 100 TeamNumber, paid, chargeback, firstname, lastname, metinst, prestndate, primaryid, repname, grosssaleprice * teamcommissionpercent * repcommissionsplit / 10000 AS Commission, member_id, CommissionID FROM RepCommission WHERE (primaryid LIKE @primaryid) AND (grosssaleprice > 0)is works fine. However I need the calculated field (commission) to be formated as Currency, can any one help?thanks alot |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2008-01-08 : 15:45:49
|
That is a presentation issue, not a database issue. Simply format the output any way you want where you are displaying the data (report, web page, application, spreadsheet, etc). The only way to "format" data in SQL Server is to write convoluted expressions to convert your columns to VARCHAR, which means they no longer have the proper data type and will not sort, compare, calculate, etc, correctly like a true datetime or money data type would.- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
blackX
Posting Yak Master
102 Posts |
Posted - 2008-01-08 : 16:18:20
|
quote: Originally posted by jsmith8858 That is a presentation issue, not a database issue. Simply format the output any way you want where you are displaying the data... - Jeffhttp://weblogs.sqlteam.com/JeffS
This is exactly what I am asking how to do. This query is in a lookup grid. How would I do it? |
 |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-01-08 : 18:53:12
|
CAST(grosssaleprice * teamcommissionpercent * repcommissionsplit / 10000 AS MONEY) AS Commission |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2008-01-08 : 20:08:40
|
What kind of lookup grid? where? In what type of application? How are we supposed to know where you are displaying the data if you don't tell us?- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
Jeff Moden
Aged Yak Warrior
652 Posts |
Posted - 2008-01-12 : 22:43:09
|
I'm thinking someone is having a frustrating day ;-)--Jeff Moden |
 |
|
|
|
|
|
|