[dba-SQLServer] Returning a dataset

Robert L. Stewart robert at webedb.com
Tue Mar 25 14:40:39 CDT 2008


Arthur,

All of my Insert, Update and Delete SPROCS return result sets.

The insert returns the record inserted.
The Update returns the record updated.
The Delete returns the rows deleted or in 2005, the actual record deleted.

Robert

At 01:00 PM 3/25/2008, you wrote:
>Date: Tue, 25 Mar 2008 06:41:03 -0400
>From: "Arthur Fuller" <fuller.artful at gmail.com>
>Subject: Re: [dba-SQLServer] Returning a dataset
>To: "Discussion concerning MS SQL Server"
>         <dba-sqlserver at databaseadvisors.com>
>Message-ID:
>         <29f585dd0803250341u3ac0906eo23fb5e3b3c8ef9f8 at mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>Depends what you mean by data set. Result set is the more common term in SQL
>circles, but that may be what you mean. Update, delete and insert sprocs
>don't really return result sets, although they do tell you how many rows
>were affected. Select sprocs always return result sets, although said set
>may consist of zero rows.
>
>TOP n also depends on which version of SQL Server you are using. In 2005 and
>2008, TOP accepts an argument so you don't have to construct the statement,
>you can just pass in a variable and plug it into the code:
>
>CREATE PROCEDURE myProc (@n int)
>AS
>     SELECT TOP @n [PERCENT] * FROM someTables         -- percent is optional
>     ... etc.
>
>Arthur





More information about the dba-SQLServer mailing list