How to retrieve SQL variables from CFQuery?

I run it in my cfquery.

SET @rID = (SELECT TOP 1 roleid
FROM Roles
WHERE RoleName = @rName AND appid = @appID
ORDER BY Created DESC);

Is it possible to retrieve @rID without having to run the SELECT query again?
Such as:

The above obviously does not work, but is there any other way to return variables from the query ?

You can select it to get the value of @rID without having to run the full query again. < p>


SET @rID = (SELECT TOP 1 roleid
FROM Roles
WHERE RoleName = @rName AND appid = @appID
ORDER BY Created DESC);
SELECT @rID AS rID

I run it in my cfquery.

SET @rID = (SELECT TOP 1 roleid 
FROM Roles
WHERE RoleName = @rName AND appid = @appID
ORDER BY Created DESC);

Is it possible to retrieve without having to run the SELECT query again@ rID?
Such as:

The above obviously does not work, but is there any other way to return variables from the query ?

You can get the value of @rID by selecting it without running the full query again.


SET @rID = (SELECT TOP 1 roleid
FROM Roles
WHERE RoleName = @rName AND appid = @appID
ORDER BY Created DESC);
SELECT @rID AS rID

< /p>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2736 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.