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 ?
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>