No need for the SELECT @@IDENTIY row.
DECLARE @PhysicalID AS int
SET @PhysicalID = @@IDENTITY
I would suggest using SCOPE_IDENTITY instead, however.
Scope Identity[
^]
I personally don't like this approach, however,
It would make more stable to perform a SELECT FROM the PhysicalTest table on all the input values to guarantee that the row wrote and that you have the ID for that row.
INSERT INTO PhysicalTest(Height,Weight,BodyMass,BloodPressure,Temprature,RespiratoryRate,HeartRate)
VALUES(@Height,@Weight,@BodyMass,@BloodPressure,@Temperature,@RespiratoryRate,@HeartRate)
DECLARE @PhysicalID AS int
SELECT @PhysicalID = [IdFieldName]
FROM PhysicalTest WHERE Height = @Height AND Weight = @Weight ... AND HeartRate = @HeartRate
IF @PhysicalID IS NOT NULL
BEGIN
INSERT INTO PatientRecord(PhysicalTestID) VALUES(@PhysicalID)
END