Hi Guys,
Can anyone please point me in the right direction with syntax.
I want to give a default for a column depending on two other columns.
If the users don't enter the address I want to set a default address for each client.
The two columns are client and address.
I want to say if the address is null and client name = Client1 then set address = Address1.
And is the address is not null, use the address that is there.
Here is a code example:
select
case
WHEN addr is NULL AND Name = 'Client1'
then addr = 'Address1'
else addr
end
from table
I want to add a check constraint to achieve this but my syntax is wrong in the then part of the case.
Thanks in advance