SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 formatting a column display with a dollar sign
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

maggie21620
Starting Member

USA
27 Posts

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


none

Bustaz Kool
Flowing Fount of Yak Knowledge

USA
1754 Posts

Posted - 02/24/2014 :  18:02:46  Show Profile  Reply with Quote
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

USA
27 Posts

Posted - 02/25/2014 :  11:26:33  Show Profile  Reply with Quote
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

USA
27 Posts

Posted - 02/25/2014 :  11:32:17  Show Profile  Reply with Quote
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

Canada
71 Posts

Posted - 02/25/2014 :  12:19:20  Show Profile  Reply with Quote
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

India
22761 Posts

Posted - 02/26/2014 :  08:04:39  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000