stored procedure prob

  • How do I accept an array as a input parameter in a sql stored procedure. Basically what I am trying to do is that I have a sql query in a stored procedure as

    select * from P_Trade where TypeId IN(@Typeid)

    TypeId is a integer type column in the database and from the code I am passing @Typeid as varchar(100) as its value can be

    Request.form("Type") which returns 100,101,102

    but when I execute the query in sql it gives a error like Typeid cannot be converted to varchar from int

    The other way I think would be to use an array and pass it to the stored procedure but then how do I retrieve the value of this dynamic array in the stored procedure

    Thanks.

  • I suggest this onr for reading http://www.algonet.se/~sommar/arrays-in-sql.html

    Frank

    http://www.insidesql.de

    http://www.familienzirkus.de

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • select * 
    
    from P_Trade
    where charindex(','+cast(TypeId as varchar)+',',','+@Typeid+',') > 0

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply