Sqlparameters and Stored Procedure

  • Thread starter Patrick Olurotimi Ige
  • 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
 
B

billmiami2

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top