sp_describe_first_result_set with json columns
2
votes
2
answers
118
views
I'm working on an analyzer that accepts a SQL Server query and returns information about all columns in the first result set - until
for
clause is used, this is pretty straightforward with sp_describe_first_result_set
. However, the queries I expect heavily use for json
and sp_describe_first_result_set
reports columns using this clause (correctly) as nvarchar
. I've tried rolling my parser with SqlScriptDOM
, but parsing got complicated fast. I've also toyed with restructuring the inner queries via said parser so sp_describe_first_result_set
could be run against them (basically extracting them to be top-level). This approach also hit the complexity wall.
Is there any reasonable way to achieve this? When working in JetBrains' IDEs, I've checked that their built-in SQL query editor has this functionality, as hovering over a star in an inner query shows the exact columns to be selected in a tooltip.
Asked by Matěj Štágl
(205 rep)
Jun 7, 2025, 10:08 AM
Last activity: Jun 9, 2025, 06:34 PM
Last activity: Jun 9, 2025, 06:34 PM