-
I have the following stored procedure:
CREATE PROCEDURE prGetReport
@Company varchar,
@Date1 datetime,
@Date2 datetime
AS
SELECT RMAnumber,Product,SerialNumber,DateIssued,Problem
FROM tablename
WHERE CompanyCode = @Company
AND DateIssued >= @Date1
AND DateIssued <= @Date2
I then try to run this command from the query analyzer to test it:
EXECUTE prGetReport 'companyA','03/03/00','03/03/01'
When I do, I get only the field headers. I ran a simple query w/out the stored procedure requesting the same information and found several matches. I've changed the data type on the dates to 'date' but was not successful. Any suggestions?
-
To answer my own question, I needed to declare the length of the varchar variable (company) like so:
@company varchar(15)