Sqlparameters and Stored Procedure

  • Thread starter Thread starter Patrick Olurotimi Ige
  • Start date Start date
P

Patrick Olurotimi Ige

Is it possible to pass a UserID parameter to a SProcedure and retrieve
only the fields the UserID is associated with.
I have a table with fields for example:-

userid | Code
1 | erf344
2 | fergt
3 | hrg33

So if a user is logged with UserID ="1" then it should get only the code
erf344
 
Patrick,

Do you mean only the rows that the userID is associated with? How
about
---------------------------------------
CREATE PROCEDURE prGetCodes

@intUserID int

AS

set nocount on
SELECT Code
FROM myTable
WHERE userid=@intUserID

Return
 
Back
Top