Return to Snippet

Revision: 66836
at July 10, 2014 23:53 by heathbo


Initial Code
DECLARE @new_bi_number varchar(10)

SELECT @new_bi_number = invoice_next_avail_number FROM bi_broker_invoice_number WHERE mx_company_id = 1 and broker_invoice_type_id = 1

IF @new_bi_number IS NULL
BEGIN
SET @new_bi_number = 1000
SELECT @new_bi_number
END
ELSE
SELECT @new_bi_number

Initial URL


Initial Description
Declare a new_bi_number variable
Set the new variable
If the new variable is null, set it to 1000
Select it to show it
If the new variable is not null, Select it to show it

Initial Title
SQL: If / Else statement

Initial Tags


Initial Language
SQL