How do I check if a SQL Server text column is empty?

前端 未结 16 1209
粉色の甜心
粉色の甜心 2020-12-07 11:07

I am using SQL Server 2005. I have a table with a text column and I have many rows in the table where the value of this column is not null, but it is empty. Trying to comp

16条回答
  •  情书的邮戳
    2020-12-07 11:24

    I wanted to have a predefined text("No Labs Available") to be displayed if the value was null or empty and my friend helped me with this:

    StrengthInfo = CASE WHEN ((SELECT COUNT(UnitsOrdered) FROM [Data_Sub_orders].[dbo].[Snappy_Orders_Sub] WHERE IdPatient = @PatientId and IdDrugService = 226)> 0)
                                THEN cast((S.UnitsOrdered) as varchar(50))
                        ELSE 'No Labs Available'
                        END
    

提交回复
热议问题