Syntax combine two stored procedure into one [closed]

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

 FROM   [Live].[Test]
 WHERE  [_fk_RoadMapKey] = @_fk_RoadMapKey

 FROM  [Live].[SetofTestGrades] S 
 INNER JOIN [Live].[Test] T ON S.[_fk_TestKey]  = T.[TestKey]
 WHERE  t.[_fk_RoadMapKey] = @_fk_RoadMapKey

Leave a Comment