Hi All Bit rusty in sql
I have a situation where I need to insert a field "@Amount" into a temp table.If @amount from tableA is null or 0 get it from tableB
This is a simplified example of what I am doing.This must be done within a select statement when inserting into #CustomerTable Do I need a case when statement?
DECLARE @Amount DECIMAL(18,4)
SELECT @Amount=Amount
FROM TableA
INSERT #CustomerTable(id,Name,Amount)
SELECT 1,CustomerName,--if Amount is null or 0 get it from TableB else Get it from Table A.
FROM TableB