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.
Printable View
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.
You have to create stored procedure or function to get similar functionality.
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
Thank you. That should get me started.