Results 1 to 4 of 4

Thread: "Parameters" in SQL

  1. #1
    Join Date
    Jun 2004
    Posts
    2

    "Parameters" in SQL

    Microsoft Access queries allow for "parameters" or user input to set criteria (date ranges, values, etc.). I have to believe that's possible in MS SQL but I can't find a reference for it.

    Please advise.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You have to create stored procedure or function to get similar functionality.

  3. #3
    Join Date
    Jul 2004
    Posts
    12
    Here's an example of a stored procedure that accepts a parameter:

    CREATE PROCEDURE [uspGetStudentDetail]
    @StudentID Integer

    AS
    SELECT *
    FROM tblStudents
    WHERE StudentID = @StudentID


    This stored procedure can now be run (for example from the Query Analyser) like this:

    uspStudentDetail 32911

  4. #4
    Join Date
    Jun 2004
    Posts
    2
    Thank you. That should get me started.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •