Stored Procedure
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Stored Procedure

  1. #1
    Join Date
    Mar 2003
    Posts
    1

    Stored Procedure

    Dear Lifesaver

    Im having problems with sending a comma delimited value to my Stored procedure, can you please help?

    @valuelist_company_ids is a comma delimited value (1,2,3,4,5)


    If I set @valuelist_company_ids as a INT data type.

    I cant send the @valuelist_company_ids to the stored procedure because it complains thats its not a int value

    If I set @valuelist_company_ids as a VARCHAR data type.

    Sending @valuelist_company_ids as a VARCHAR to the stored procedure does not retrieve any results even though copying the query below into enterprise manager returns results.

    Can anyone please indicate what data type should be used in a stored procedure in order to query it using a comma delimited value.



    CREATE PROC SP_lt_company_contact_search_company
    @valuelist_company_ids varchar (1000)

    OUTPUT
    AS
    SELECT lcom.companyid,
    lcom.companyname,
    lllom.salescontact,
    lllom.lastaction,
    lllom.priority,
    lllom.userid,
    laom.emulate
    FROM com_ltlog_lead lllom INNER JOIN
    companies lcom ON lllom.companyid = lcom.companyid INNER JOIN
    actions laom ON lllom.lastaction = laom.actionid
    WHERE lcom.companyid IN (@valuelist_company_ids)
    ORDER BY lcom.company_name


    GO


    Thanking you very very much.

  2. #2
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    quick look at ur SP suggest that u r using SQL Sever DB....


    send the parametres in single quote...

    as ('1,2,3,4,5')

    Abhay.
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

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