getting the value in variable
-
I have a stored procedure that returns the max. number of publication views by author. I will not pass the author name, my stored procedure will select the top 1 like here. SELECT DISTINCT TOP 1 dbo.FnGetNoOfPublicationViewsByAuthor(C.CUSTOM2) AS 'TotalPublicationsViews', C.CUSTOM2 AS 'Author' FROM HDS_CUSTOM C GROUP BY C.CUSTOM2 I want to get the value of this Author seperately to use in other select statements in the same SP. how can I get it. Is there possibility? Thanks.
-
I have a stored procedure that returns the max. number of publication views by author. I will not pass the author name, my stored procedure will select the top 1 like here. SELECT DISTINCT TOP 1 dbo.FnGetNoOfPublicationViewsByAuthor(C.CUSTOM2) AS 'TotalPublicationsViews', C.CUSTOM2 AS 'Author' FROM HDS_CUSTOM C GROUP BY C.CUSTOM2 I want to get the value of this Author seperately to use in other select statements in the same SP. how can I get it. Is there possibility? Thanks.
DECLARE @TotalPublicationsViews AS VarChar(100) DECLARE @Author AS VarChar(100) SELECT DISTINCT TOP 1 @TotalPublicationsViews = dbo.FnGetNoOfPublicationViewsByAuthor(C.CUSTOM2), @Author = C.CUSTOM2 FROM HDS_CUSTOM C GROUP BY C.CUSTOM2 SELECT @TotalPublicationsViews, @Author
Declare variables as per their respective DataTypesRegards KP