Subject | Re: [firebird-support] Re: Calc field displays blank if 1 field is blank |
---|---|
Author | Alexandre Benson Smith |
Post date | 2004-08-02T20:40:22Z |
ra8009 wrote:
create trigger MyTrigger for MyTable before insert as
begin
if (new.lastname is null) then
new.lastname = ''
end
or something like this.... :-)
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
>>>This SQL produces a blank if the first or last name is blank:You can do it in your client app, but preferably in a trigger
>>>
>>>((Last_Name||', ')||First_Name)
>>>
>>>How can I write it so it will display just the last name or first name
>>>if the other name is blank?
>>>
>>>
>>I assume you mean "if the other name is NULL", right?
>>
>>There's an easy workaround by using COALESCE.
>>
>>The question is, however: why are you storing NULL?
>>Do you want to store NULL or an empty string?
>>
>>
>>
>
>I suppose that I do want to store an empty string instead of null. How
>do I accomplish that?
>
>
create trigger MyTrigger for MyTable before insert as
begin
if (new.lastname is null) then
new.lastname = ''
end
or something like this.... :-)
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br