• Hi Michelle,

    The COALESCE() function is documented here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ca-co_9dph.asp  and here http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt

    COALESCE() performs a similar function to ISNULL(), but it is more flexible and it has been standardized.  In addition to the code snippet posted previously, the second half of your code can be re-written to take advantage of COALESCE() as well:

    SELECT @PatientHospitalID = COALESCE(LTRIM(RTRIM(@PatientHospitalID)), '0')

    SELECT @GenderID  = COALESCE(@GenderID, -3)

    Note that we don't need the LTRIM(RTRIM()) around @GenderID since it's an Integer type.