diff --git a/new_targets/procs/single_price_call.ms.sql b/new_targets/procs/single_price_call.ms.sql index 0752cc9..d2a1ae5 100644 --- a/new_targets/procs/single_price_call.ms.sql +++ b/new_targets/procs/single_price_call.ms.sql @@ -245,20 +245,18 @@ BEGIN 'History' AS label, ( SELECT - CASE - WHEN q.last_price IS NOT NULL THEN 'Last Sale: ' + CAST(q.last_date AS varchar(10)) - ELSE 'No Recent' - END AS label, - COALESCE(q.last_price,0) AS value, - CASE - WHEN q.last_price IS NOT NULL THEN 'currency' - ELSE 'currency' - END AS type, - CASE - WHEN q.last_price IS NOT NULL THEN q.last_source + CASE WHEN q.last_order = 0 THEN ' Qt# ' + q.last_quote ELSE ' Ord# ' + q.last_order END - ELSE NULL - END AS note - FOR JSON PATH + 'Last Price' AS label, + q.last_price AS value, + 'currency' AS type, + CONCAT( + 'Source: ', ISNULL(q.last_source, 'N/A'), + ' | Date: ', ISNULL(CONVERT(varchar(10), q.last_date, 120), 'N/A'), + ' | Order: ', ISNULL(q.last_order, 'N/A'), + ' | Quote: ', ISNULL(q.last_quote, 'N/A'), + ' | Dataseg: ', ISNULL(q.last_dataseg, 'N/A'), + ' | Qty: ', ISNULL(CAST(q.last_qty AS varchar(32)), 'N/A') + ) AS note + FOR JSON PATH, WITHOUT_ARRAY_WRAPPER ) AS details UNION ALL