returning values from a stored proc (or function?)

  • I am trying to create a reusable proc that will generate network ids and passwords for people in my database when certain conditions are met. Basically, I pass the proc the key for the person, and then the network id and password are created if they don't already exist. That part is done. This challenge is that I want this proc available to call from other procs, and in most cases I will need those created values returned. Obviously I could just run a select statement after the proc call, but I'm trying to avoid that.

  • Look up CREATE PROCEDURE in books online and look at the OUTPUT Parameters section.

  • There's also a section in Books Online on OUTPUT PARAMETERS specifically. It not only talks about creating them within procedures, but the syntax on how to use them to call procedures. Read that. If you get stuck, repost.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply