Execute stored procedure in OUTER APPLY block
问题 Why I can not use a stored procedure in OUTER APPLY block? I need to get int value from the stored procedure dbo.GetTeacherId and use this in WHERE clause. Here my code: USE [StudentsDb] DECLARE @teacherIdOut int; SELECT StudentLastName, StudentFirstName, StudentMiddleName, LessonName, Score, TLastName, TFirstName, TMiddleName FROM Scores JOIN Students ON Scores.StudentId=Students.StudentId JOIN Lessons ON Scores.LessonId=Lessons.LessonId OUTER APPLY ( EXECUTE dbo.GetTeacherId 0, 0,