Hello,
I have a question about SQL statement. Maybe @QMcKay
I try to do a select in the ticket table to get the value of a ticket Tag I created so I can make a WHERE clause with that value…
SELECT
tkt.[TicketNumber]
,tkt.[Date]
,tkt.[TotalAmount]
,tkt.[TicketTags]
,tkt.[TransactionDocument_Id]
FROM [dbo].[Tickets] tkt
WHERE value = ...
TicketTags will return something like this:
[{"TN":"SunatNumber","TT":0,"TV":"384"}]
And I would like to extract - inside the SQL - the value 384.
Is it possible ?
Marc
Using:
...
,Substring(tkt.[TicketTags],35,len(tkt.[TicketTags])-37) as SunatNumber
...
helps … for TicketTags =
[{"TN":"SunatNumber","TT":0,"TV":"274"}]
or
[{"TN":"SunatNumber","TT":0,"TV":"1041"}]
but sometimes I have 2 tickets TAGs =
[{"TN":"PorConsumo","TT":1,"TV":"1"},{"TN":"SunatNumber","TT":0,"TV":"783"}]
… in which case, it does not work.