joins- how to pass the parameter in stored procedure to execute a join query

Posted by Ranjana on Stack Overflow See other posts from Stack Overflow or by Ranjana
Published on 2010-04-24T05:39:55Z Indexed on 2010/04/24 5:43 UTC
Read the original article Hit count: 316

Filed under:
|
|

i have used joins to get datas from two tables under comman name. as

SELECT userValidity.UserName, userValidity.ValidFrom,userValidity.ValidUpTo,userValidity.TotalPoints, persons.SenderID FROM userValidity INNER JOIN persons ON userValidity.Username=tbl_persons.Username

but i need to execute this query with oly the username which i pass as parameter in stored procedure..

how to pass the username in stored procedure in this joins.

alter procedure GetNameIDUserInformation ( @user varchar(max) ) as begin

SELECT userValidity.UserName, userValidity.ValidFrom,userValidity.ValidUpTo,userValidity.TotalPoints, persons.SenderID FROM userValidity INNER JOIN persons ON userValidity.Username=tbl_persons.Username end

in this SP, where i have to pass the user parameter to get the single row of my user record

© Stack Overflow or respective owner

Related posts about stored-procedures

Related posts about sql