• We use JScript in the ASP environment, which to my knowledge does not support passing variables into the ADO object (like VBscript would allow) - so we must return a recordset in order to retrieve values from SQL. In the case of a simple insert, returning a recordset with the row Id is necessary. However, if that insert routine is called from another procedure the "row Id" recordset is probably not desired in the ADO results that the client (web server) is expecting. To manage multiple use of the insert procedure, I have been doing this:

    create procedure spExample

    @rowid int = null OUTPUT

    ,@returnRecordset bit = 0

    as

    begin

    /* body of procedure */

    set @rowid = scope_identity()

    if @returnRecordset = 1

    select [rowid] = @rowid

    end

    The Jscript caller over ADO uses: (needs a recordset)

    execute spExample @returnRecordset = 1

    Other stored procedures use: (do not pollute ADO results with extraneous recordset)

    execute spExample @rowid = @newPKID OUTPUT

    [Other likely parameters for an insert operation were omitted to simplify the example]