Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SP Resultset Vs Output Parameter!! Performance?

Author  Topic 

Jothikannan
Starting Member

36 Posts

Posted - 2009-06-29 : 03:05:11
Hi,

I am going to write a Stored Procedures and it should return a XML (size is nearly 200000 characters) from a table.

Which way is best in terms of performance , Resultset or Output parameter ?(this sp will be called by ADO.NET)

Appreciate any help!

Thanks
Jothi

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-29 : 03:17:49
An OUTPUT parameter should be faster, if you call the SP correctly (adExecuteNoRecords option), because there would be no overhead for creating and sending a resultset back over network.
But the time difference would also be small, since the resultset would consist of 1 record and 1 column. But still...
Use an output parameter.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-29 : 03:19:22
If you want to be flexible, add a new parameter named @OutputStyle.

If @OutputStyle is equal to "parameter" set output parameter to the value.
If @OutputStyle is equal to "resultset" do as normal and return a resultset.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Jothikannan
Starting Member

36 Posts

Posted - 2009-06-29 : 04:27:27
Thanks a lot
Go to Top of Page
   

- Advertisement -