- This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
Viewing 11 posts - 1 through 11 (of 11 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I am trying to write a query that will add a dollar sign onto the values in the ExtendedPrice field. This is a working query
SELECT FK_PONBR AS ‘Part Numbers’,
Quantity AS ‘Part Quantity’,
ExtendedPrice
FROM PO_LINE_ITEM
I am working in Microsoft SQL Server Management Studio Express.
How do I add a $ sign?
As you are pulling the data is there any reason why you can not do it when you echo out the data? Just if you have the data and you are using PHP for example you can just add the dollar sign then… ?
yes, the reason that I am not doing it in php is that I want to know how to do it in sql
Well the thing is I don’t think you can when selecting data and I don’t really see the benefit of doing it anyway? Is there something I am missing?
simply. you can’t do that with sql. adding a $ in sql causes it to look at the item as a variable found in php ($name). it assumes it’s a variable since the $ is not a default special character such as %.
I am doing the work in Microsoft sql server 2005. Not using php at all. Just putting in queries and returning results. No php is being used. I posted the topic here because this forum is the closest to sql. I think there is a way to do it. I just can’t make it work.
I would definitely be interested to know if there is a way…
best file name ever.
adollarsignisanotheranchoringoperatorandmatchesonlytheendofastring.htm
Hahaha
this query added the dollar sign to the money
SELECT ‘$’ + CONVERT(CHAR(5), cost, 0)
FROM PART;
I had to convert the results of the cost column and the zero means to add two decimal places. This is what the query returned
$0.59
$0.66
$5.77
$6.12
$0.88
$0.94
$0.74
$2.09
$1.87
$1.96
$3.55
$3.65
$3.58
Awesome! nice find!