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
 General SQL Server Forums
 New to SQL Server Programming
 formatting a column display with a dollar sign

Author  Topic 

maggie21620
Starting Member

27 Posts

Posted - 2014-02-24 : 15:41:52
does anyone know how to implement the display of a dollar sign for an output in a qry


none

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-02-24 : 18:02:46
select '$' -- ???

===============================================================================
There are two kinds of light -- the glow that illuminates, and the glare that obscures. -James Thurber (1894-1961)
Go to Top of Page

maggie21620
Starting Member

27 Posts

Posted - 2014-02-25 : 11:26:33
that worked find to label a column heading but how do i put it into my qry to show $in front of the sum totals?

none
Go to Top of Page

maggie21620
Starting Member

27 Posts

Posted - 2014-02-25 : 11:32:17
also filled a column with the $ but where in my qry would i put it to add it to the dollar amounts my qry reads:
SELECT
adHock.dbo.PPVVINCE$.Corps, adHock.dbo.PPVVINCE$.House, adHock.dbo.PPVVINCE$.Cust,
SUM(PPV_TOTAL) AS PPVTotal

FROM adHock.dbo.PPVVINCE$ INNER JOIN
IDST_74_CUSTOMER ON adHock.dbo.PPVVINCE$.Corps = IDST_74_CUSTOMER.ACCTCORP AND
adHock.dbo.PPVVINCE$.House = IDST_74_CUSTOMER.HOUSE AND adHock.dbo.PPVVINCE$.Cust = IDST_74_CUSTOMER.CUST

GROUP BY adHock.dbo.PPVVINCE$.Corps, adHock.dbo.PPVVINCE$.House, adHock.dbo.PPVVINCE$.Cust
ORDER BY PPVTota

none
Go to Top of Page

maunishq
Yak Posting Veteran

71 Posts

Posted - 2014-02-25 : 12:19:20
Always do the format in SELECT statement. Rest of the clauses are for sorting.
USE '$'+CAST(CONVERT(DECIMAL(30,2),column_name) AS varchar(30))

for e.g. in your query:
SELECT
adHock.dbo.PPVVINCE$.Corps, adHock.dbo.PPVVINCE$.House, adHock.dbo.PPVVINCE$.Cust,
'$'+CAST(CONVERT(DECIMAL(30,2),SUM(PPV_TOTAL) AS varchar(30)) AS PPVTotal
FROM......................................



!_(M)_!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2014-02-26 : 08:04:39
This is the formation issue that should be done in a front end application.

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -