This project is read-only.

Output parameters

Sep 3, 2010 at 5:23 PM

Hi Anton,

a question a day: what about reading output parameters from stored procedures? :)

Imagine you have a proc that returns a recordset, but that also has an output param to tell you the total number of records found (DNN itself has some doing this): I think I should write a custom function in this case, to process output param(s) and somehow return them along with data, do you confirm?

I looked at sources this time, but did not see anything related with output parameters.


Sep 4, 2010 at 8:41 AM


You can access output parameters by adding them to SQL Server results pipeline:

<xsl:variable name="sql">
   declare @TotalCount int;
   exec SomeProcedure @SomeInPrm, @TotalCount out;
   select @TotalCount as TotalCount;

<xsl:variable name="results"
   select="mdo:sql($sql, 'row, total', '@SomeInPrm', 'some-value')" />

Total count is: {{$results//total/TotalCount}}

You can get more details of how this works by exploring $results variable as follows


This technique is possible only with mdo:sql. mdo:xml does not allow you to do that.