ALTER PROCEDURE [Lending].[uspHMDALarIncomeGet] (@ApplicationId int)
AS
BEGIN
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
-- Total Income Data
DECLARE @ApplicantId int = (SELECT AT.ApplicantId FROM Lending.Applicant AT WHERE AT.ApplicationId = @ApplicationId)
SELECT
I.Amount
FROM Lending.Income I WHERE I.ApplicantId = @ApplicantId
END
Do you guys know how this proc can be written to succeed in 05?
-Scott
SQL2005 does not have the syntax to declare and assign a variable in the same statement. You would need to change
To
Edit:
It’s just occurred to me that I might have changed the semantics a bit there if there can ever be more than one row matching
AT.ApplicationId = @ApplicationId.Would retain the original semantics and cause an error in that event.