Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

XML Cast to NVARCHAR(MAX) Assigned to String Truncated?

$
0
0

Hi there!

I am using a tried-and-true stored procedure that returns XML data in an XML typed output parameter:
procedure dbo.MyPoc @MyMessage XML OUTPUT;

Within a T-SQL framework I use the @MyMessage variable to then shred and insert into a table.

Now I am trying to use the sproc in an SSIS Execute SQL Task:

execute dbo.MyProc @MyMessage = @xml output;
set ? = cast(@xml as nvarchar(max));

... mapping the output to a String SSIS variable.

When I tried in a subsequent ExecuteSQLTask to retrieve that String variable and cast it to XML, that produced an error, and the value appeared to be truncated:

declare @xml xml;
set @xml = cast(? as xml);

I set a breakpoint on the sproc execution task PostExecute, and the Watch window displays a truncated String value 8222 bytes long.  I thought that both String and NVARCHAR(MAX) are 2GB long.

Am I doing something wrong or missing something? Is there a proper/customary way of retrieving an XML value from a stored procedure?
I am not looking for lengthy workarounds if this is not a supported feature.

Thank you in advance!


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>