During playing with sys.dm_exec_describe_first_result_set
I get to this point:
CREATE TABLE #tab(col INT, x XML );
INSERT INTO #tab(col,x) VALUES (1
Interesting question! The NTEXT
is really strange!
I have an idea about the sub-query: When you return an XML it is ever transfered as string, unless you specify TYPE
(You surely know this from nested XML with CROSS APPLY or from string concatenation with STUFF, where you somethimes see this with TYPE
and a follwing .value()
- and sometimes "naked".
I could not really reproduce your results (SQL Server 2012 too). Simple copy'n'paste comes back with (I wanted to test with declared table variable and return value of a function):
Simple XML NULL NULL
Wrapped with subquery NULL NULL
XML column NULL NULL
Casted XML x xml
Wrapped Casted XML wrapped xml
Text value text_string ntext
Wrapped Text Value text_string_wrapped ntext
EDIT: There was a new observation I thought was unclear, but it was my mistake... Took it away...