1
select 'TEM' AS InSituacao
from GTCLogist
where NrPlacaCarreta = ''
and ID <> '35514'
and year(DtBase)=year(GETDATE())
and MONTH(DtBase)=MONTH(GETDATE())
and DAY(DtBase)=DAY(GETDATE())
I have the SQL above, I need that when the field is empty do not return me anything. I have tried the isnull
but how the field is blank and not null
I don’t know if I made the right use.
What field when it’s blank should not return anything to you?
– R.Santos
NrPlacaCarreta
– KevinF
Tried to use
coalesce
?– Artur Trapp
What do you mean, "stay blank"?
– Ismael
What is the structure of the table?
– David
@Kevin. F: There is difference between non-valued column (NULL), empty string column ('), or empty column (' '). Which means "blank", in your case?
– José Diz
@Kevin. F: How is the Dtbase column declared? If it is like datetime, the column contains date only (e.g., "2015-02-22") or contains date and time (e.g., "2015-02-22 02:35:12") ?
– José Diz
Try:
nomeColuna IS NOT NULL AND nomeColuna != ''
, so if the column is valuednull
or if you have the white value (as I think it is your case) it will not bring.– Max Rogério