1
I have a problem to format a column in gridview, this column takes three values from the concatenated database, utlimo value can be null, if null has with not present the last trace that separates the value 2 from the value 3.
SELECT TOP(20) IdItem, IdComanda,
(convert(varchar(10),IdProduto) + ' - ' + Produto.nomeproduto + ' - ' + isnull(complemento,'')) as 'Item',
Unid,
Qtde,
isnull(Pessoa.Apelido,'--') as 'Garcon',
idStatusEntrega as 'Status',
dtSolicitacao as 'HrSolicitacao',
dtPreparo as 'HrPreparacao',
Comanda.NrComanda, Comanda.NrMesa
FROM ComandaItem
inner join Produto ON produto.ProdId = ComandaItem.IdProduto
INNER JOIN Comanda ON ComandaItem.IdComanda = Comanda.Id
left join Pessoa ON Pessoa.IDCadastro = ComandaItem.IdVendedor
WHERE (idStatusEntrega = 1)
and (@IdSetorPreparo = 0 or IdSetorPreparo = @IdSetorPreparo)
ORDER BY dtPreparo DESC
I thought about it, but I don’t think it works. The
isnull
will check the result of concatenation, does it understand when it is null after that ?– DontVoteMeDown
It does work. This answer is correct.
– bruno