Results 1 to 2 of 2

Thread: Stored Procedure

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    Tennessee
    Posts
    279

    Question

    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?
    A cynic knows the price of everything but the value of nothing.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    Tennessee
    Posts
    279
    To answer my own question, I needed to declare the length of the varchar variable (company) like so:

    @company varchar(15)
    A cynic knows the price of everything but the value of nothing.

Posting Permissions

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



Click Here to Expand Forum to Full Width