M
Mitchell_Collen via AccessMonster.com
Hi. Will you please help me resolve this conversion error?
Syntax error converting varchar 1.8 to a column of datatype int.
I have looked at my data and 1.8 is the first value in the column named:
ResultValueCreatinine. Then I used this function: CONVERT(int,
ResultValueCreatinine)
Will you tell me what could be wrong? Below is my code.
ALTER PROCEDURE Pharmacy.StoredProcedure1
AS SELECT Visit#, MRN, EventTime, ResultNumber, ResultNameCreatinine,
ResultValueCreatinine, Abnormal AS CreatinineAbnormal, ResultNameWeight,
ResultValueWeight, Abonormal AS WeightAbnormal, Sex,
PatientName, Age, AgeType, Height, Race, Status,
'IBW' = CASE WHEN Sex = 'F' THEN (((Height / 2.54) - 60)
* 2.3) + 45.5 WHEN Sex = 'M' THEN (((Height / 2.54) - 60) * 2.3) + 50 END,
'Clearance' = CASE WHEN Sex = 'F' THEN (((140 - [age])
* (((Height / 2.54) - 60) * 2.3) + 45.5) / (CONVERT(int,
[ResultValueCreatinine]) * 72))
* 0.85 WHEN Sex = 'M' THEN (((140 - [age]) * (((Height
/ 2.54) - 60) * 2.3) + 50) / (CONVERT(int, [ResultValueCreatinine]) * 72)) *
0.85 END
FROM Pharmacy.CCreatinineWithWeight
Syntax error converting varchar 1.8 to a column of datatype int.
I have looked at my data and 1.8 is the first value in the column named:
ResultValueCreatinine. Then I used this function: CONVERT(int,
ResultValueCreatinine)
Will you tell me what could be wrong? Below is my code.
ALTER PROCEDURE Pharmacy.StoredProcedure1
AS SELECT Visit#, MRN, EventTime, ResultNumber, ResultNameCreatinine,
ResultValueCreatinine, Abnormal AS CreatinineAbnormal, ResultNameWeight,
ResultValueWeight, Abonormal AS WeightAbnormal, Sex,
PatientName, Age, AgeType, Height, Race, Status,
'IBW' = CASE WHEN Sex = 'F' THEN (((Height / 2.54) - 60)
* 2.3) + 45.5 WHEN Sex = 'M' THEN (((Height / 2.54) - 60) * 2.3) + 50 END,
'Clearance' = CASE WHEN Sex = 'F' THEN (((140 - [age])
* (((Height / 2.54) - 60) * 2.3) + 45.5) / (CONVERT(int,
[ResultValueCreatinine]) * 72))
* 0.85 WHEN Sex = 'M' THEN (((140 - [age]) * (((Height
/ 2.54) - 60) * 2.3) + 50) / (CONVERT(int, [ResultValueCreatinine]) * 72)) *
0.85 END
FROM Pharmacy.CCreatinineWithWeight