You cannot assign data to a variable and also return data using single select statement, If you are using @TestKey
to retrieve value from another table then you can skip variable and use join to get data from another table, try this
SELECT *
FROM [Live].[Test]
WHERE [_fk_RoadMapKey] = @_fk_RoadMapKey
SELECT S.*
FROM [Live].[SetofTestGrades] S
INNER JOIN [Live].[Test] T ON S.[_fk_TestKey] = T.[TestKey]
WHERE t.[_fk_RoadMapKey] = @_fk_RoadMapKey
1
solved Syntax combine two stored procedure into one [closed]