SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    .NET inside archigamer's Avatar
    Join Date
    Jan 2002
    Location
    Strongsville OH
    Posts
    1,534
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL stored procedures and output

    I have the following stored procedure

    Code:
    CREATE PROCEDURE GetProductInfo
    @productId int,
    @productTitle varchar(100) output,
    @productAvailability varchar(50) output,
    @productManufacturer varchar(50) output,
    @productDescription varchar(2000) output,
    @productPrice float output
     AS
    select @productTitle = p.product_title, 
    		  @productPrice = p.product_price, 
    		  @productDescription = p.product_description, 
    		  @productManufacturer =  m.manufacturer_title, 
    		  @productAvailability = a.availability_text
    from product p 
    right join availability a on p.product_id = a.availability_id
    right join manufacturer m on p.product_manufacturer = m.manufacturer_id
    where product_id = @productid;
    GO
    for some odd reason when I run it, it expects the @productTitle to be defined with a value? Can anyone explain why it would want it defined if its an output parameter or how I can fix it so it doesnt require a value to run it?
    Web Finesse Studios
    Professional, business oriented web hosting and development.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,274
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    oh man, it's been years since i wrote a stored proc, but don't you need to put the parameter list into parentheses?

    CREATE PROCEDURE GetProductInfo
    ( @productId int
    , @productTitle varchar(100) output
    , ...
    )
    AS

    rudy
    http://r937.com/

  3. #3
    .NET inside archigamer's Avatar
    Join Date
    Jan 2002
    Location
    Strongsville OH
    Posts
    1,534
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    unfortunatly that has no effect on the results still asking for a value.
    Web Finesse Studios
    Professional, business oriented web hosting and development.

  4. #4
    Database Jedi MattR's Avatar
    Join Date
    Jan 2001
    Location
    buried in the database shell (Washington, DC)
    Posts
    1,107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @productTitle varchar(100) = null output

  5. #5
    .NET inside archigamer's Avatar
    Join Date
    Jan 2002
    Location
    Strongsville OH
    Posts
    1,534
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    actually i found what the problem was, I declared @productId but in the where statement i had @productid, I am suprised that wasnt caught by enterprise manager, but oh well.
    Web Finesse Studios
    Professional, business oriented web hosting and development.


Bookmarks

Posting Permissions

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