I've done simple stored procedures before to "increase performance"
(which I already heard today doesn't necessarily do that) but I'm
wanting to get into using SQL stored procedures for more in depth stuff.
One thing I'm not sure on how it works is as follows:


CREATE PROCEDURE [dbo].[sm_login]
@username varchar(40)
@password varchar(40)
AS
select firstname, lastname, userID
  from users
  where username = @username  and password = @password


<!----Now, depending on the value (if any) returned from the above query
I want to grab some other info based on the userID from another table.
How do I reference the value returned from above? ---->

In CF, I'd compare it to:


<cfquery...name="query1">
select firstname, lastname, userID
from users
where username = '#form.username#' and password = '#form.password#'
</cfquery>


<cfquery...name="query2">
select somethingelse
from anothertable
where userID = #query1.userID#
</cfquery>

Is there any way to do something similar in a stored procedure?  Thanks!


John Burns
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to