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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Currency Formatting

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 statement

SELECT 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.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

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... - Jeff
http://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?
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2008-01-08 : 18:53:12
CAST(grosssaleprice * teamcommissionpercent * repcommissionsplit / 10000 AS MONEY) AS Commission
Go to Top of Page

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?

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

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
Go to Top of Page
   

- Advertisement -