Q:

Is there an inline option that checks for null and blank in T-SQL?

I have a WebForms application that binds the following result set of errors to a data grid.
    SELECT missing.ID, '--Not Found--', '--Not Found--', 'Timeclock ID ('+missing.TimeClock_System_ID+') not found' AS ErrorMessage
    FROM @StudentRecords missing 
    WHERE missing.Registration_ID IS NULL

The last column creates a string that later gets bound to the data grid, it usually looks something like this: "Timeclock ID (1234) not found"
Problem is that when missing.TimeClock_System_ID == null the whole string breaks and returns "" instead of "Timeclock ID () not found".
My current workaround is:
ISNULL ( missing.TimeClock_System_ID , 'NULL' )

But This breaks down when the value is an empty string.
Thanks in advance :)

A:

try: 
ISNULL ( nullif(missing.TimeClock_System_ID,'') , 'NULL' )

