jobprojn
asked on
T-SQL - Concatenate Memo and Currency
Hello. I have two fields, one memo and the other currency. I need to concat both fields into a single field but I need the currency format for the PurchaseOrder.Amount to stay intact with comma separators. My current code is shown below. Problem here is the PurchaseOrder.Amount field looses all commas (i.e. $23335561.23)
Anybody have a relatively simple solution?
[NewMemo] = CAST(PurchaseOrder.Memo AS Nvarchar(2000))
+ ' $'
+ CAST((PurchaseOrder.Amount + tax1 + tax2 + tax3) AS nvarchar(20))
Anybody have a relatively simple solution?
[NewMemo] = CAST(PurchaseOrder.Memo AS Nvarchar(2000))
+ ' $'
+ CAST((PurchaseOrder.Amount
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just seconds late...
I see Shannon has already given you the answer. Convert allows you to specify the style, check BOL.
I see Shannon has already given you the answer. Convert allows you to specify the style, check BOL.
ASKER
Beautiful. Thanks.
[NewMemo] = CAST(PurchaseOrder.Memo AS Nvarchar(2000))
+ ' $'
+ CONVERT(nvarchar(20), convert(money, PurchaseOrder.Amount + tax1 + tax2 + tax3), 1)