0

This question offers the canonical way of doing this in SQL Server, but it doesn't work in Azure Synapse.

Because it is a temp table, I cannot look in INFORMATION_SCHEMA, and I can't query tempdb or tempdb.columns like one might normally.

I'd like a query that yields the column stack from #test

IF OBJECT_ID('tempdb..#test') IS NOT NULL
BEGIN
    DROP TABLE #test
END;

CREATE TABLE #test
WITH (DISTRIBUTION=ROUND_ROBIN,HEAP)
AS (
SELECT 'overflow' as stack
);

SELECT * FROM #test
CHEEKATLAPRADEEP
  • 12,191
  • 1
  • 19
  • 42
Anders Swanson
  • 3,637
  • 1
  • 18
  • 43

1 Answers1

3

You can't, sorry.

The only workable "solution" is to CTAS a row to a table outside tempdb, then inspect its columns from sys.columns or information_schema.

Ron Dunn
  • 2,971
  • 20
  • 27