CREATE TABLE #tab(col INT, x XML ); INSERT INTO #tab(col,...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

CREATE TABLE #tab(col INT, x XML );
    INSERT INTO #tab(col,x) VALUES (1,NULL), (2,NULL), (3,'<a>x</a>');

    
    SELECT 'Simple XML' AS description, name, system_type_name
    FROM sys.dm_exec_describe_first_result_set(
       N'SELECT col AS col
         FROM #tab
         FOR XML AUTO, TYPE', NULL, 0)  
    UNION ALL
    SELECT 'Wrapped with subquery', name, system_type_name
    FROM sys.dm_exec_describe_first_result_set(
       N'SELECT(SELECT col
                FROM #tab
                FOR XML AUTO,TYPE) AS wrapped_subquery', NULL, 0)

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results