Apologies I have searched for a question to my answer to no avail.
I have the following column which has the following narrative
Narrative
- The budget for this is 68000 GBP
- Product C will cost GBP 300000
- Product B will cost -6650 EUR
I've managed to create a currency column with a case statement and now I'm trying to create a column with just the numeric values and removing all text except for the numeric values.
I want to go from having
Narrative
---------------------------------
The budget for this is 68000 GBP
Product C will cost GBP 300000
Product B will cost -6650 EUR
to
Values Currency
---------------------
68000 GBP
300000 GBP
(650) EUR
I'm just wondering if there is a quick way of doing this with T-SQL. There isn't a delimiter in the narrative column I can use but the numeric values are always the last text in the string.
Many thanks
Apologies I've not got this to work maybe being novice I was unable to explain but here is my code
~SELECT SYSAccountingPeriodID, GoodsValueInBaseCurrency, TransactionDate, Reference, Narrative, UserName, CASE WHEN Narrative LIKE '%USD%' THEN 'USD' WHEN Narrative LIKE '%GBP%' THEN 'GBP' WHEN Narrative LIKE '%EUR%' THEN 'EUR' ELSE 'EUR' END AS Currency FROM dbo.NLPostedNominalTran~
Here is the output