joins- how to pass the parameter in stored procedure to execute a join query
- by Ranjana
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