sql - If not <> NULL then "xxxField" equals '1' -


I'm guessing it's quite easy. I need to edit a line in the SELECT statement, to see if the value of NULL is in a field. If there is a zero value, then I need a new column (not a name) to display '0' for the row where the data in the row is to display '1' in that line Is there any way to do this without modifying the logic? (SQL Server Management Studio is used to)

Here's the code:

  DISTINCT t.Name change selection (VARCHAR (10), t.DischargeDateTime, 120) DischargeDate as in, t.PatientPortalEnabled, t.Allergy change (VARCHAR (10), as t.AllergyUpdateTime, 120) AllergyUpdate, / * this is where I want to put * / & lt argument if possible Are; & Gt; Zero, t.ElapseTimeForAllergyUpdateInMinutes, t.OldValue, t.NewValue, t.ElapseTimeForAllergyUpdateInHours, t.DischargeDateTime  

Try this:

  case when MyField zero either 0 or 1 at the end  

here is my code:

change (VARCHAR (10), t.DischargeDateTime, 120) converted as DischargeDate, t.PatientPortalEnabled, t.Allergy (VARCHAR (10), t.AllergyUpdateTime, 120) as AllergyUpdate, the case when t.MyField zero to 0 or 1. finally, t.ElapseTimeForAllergyUpdateInMinutes, t.OldValue, t.NewValue, t.ElapseTimeForAllergyUpdateInHours, t.Discha RgeDateTime is

Comments