views:

54

answers:

2

If I'm creating a C# wrapper for a stored proc, and that sp only returns/selects (not sure) 1 value, should I use return or select at the end of that sp?

This is for t-sql.

+2  A: 

You have a couple choices. You can use an OUTPUT parameter to your stored procedure, a Select statement, or a return value. If I had to guess, I would say an OUTPUT parameter would be the most commonly used given your situation.

Randy Minder
+1. It's also much easier to chain procedure calls when using `OUTPUT` parameters rather than a result set or a return value.
Adam Robinson
+6  A: 

Return can only return (no pun intended) an integer and you can only return 1 value

An output parameter can return all datatypes and you can have multiple output parameters per proc

A select statement can return a resultset

It all depends what you want to accomplish in your calling code, I myself prefer output parameters

SQLMenace