SQL - User input in query

sql, sql-server

Solution

Here's the code for a stored procedure:

CREATE PROCEDURE SomeName(@UserStart DATETIME, @UserEnd DATETIME) 
AS BEGIN

SELECT somestuff
FROM sometable
WHERE somedate BETWEEN @UserStart AND @UserEnd

END

Problem

I have this. "Detail all films shown by the club between any two given dates, inputted by the user. For example a club member must be able to input a start date and an end date for the parameters for the query" Now, how would I go about doing the user input? Only way I can think of would to be using php or something with a html form getting the values and then submitting them as variables in the query. However, that's not what is needed. So, how is this done so the query would ask for values? Or can't you? My query so far looks like so. ``` SELECT film.title, film.desc, show.sdate, show.fdate FROM film INNER JOIN show ON film.ID=show.filmID WHERE sdate = '&userstart' AND fdate = '&userend' ``` How do I go about with the user input? Also, is the query correct? I have no way of testing, I only have a design not an implementation. Thanks a lot Edit: Using Windows system, MS SQL Server.

Original source