Hello Everybody,
Here are one of my colleague was facing issue regarding divide by zero error and some NULL column concatenation issues, below are the simple way to get rid off:
--Divide by zero
DECLARE @Dividend AS INT=5
DECLARE @Diviser AS INT=0
SELECT ISNULL(@Dividend/NULLIF(@Diviser,0),0) DivideByZero
--Suppress NULL value to next value
DECLARE @FirstName as varchar(50)=NULL
DECLARE @LastName as varchar(50)='Pathak'
SELECT COALESCE(@FirstName, @LastName) COALESCE_Example
I hope it will help you out.
Cheers,
ved pathak
Here are one of my colleague was facing issue regarding divide by zero error and some NULL column concatenation issues, below are the simple way to get rid off:
--Divide by zero
DECLARE @Dividend AS INT=5
DECLARE @Diviser AS INT=0
SELECT ISNULL(@Dividend/NULLIF(@Diviser,0),0) DivideByZero
--Suppress NULL value to next value
DECLARE @FirstName as varchar(50)=NULL
DECLARE @LastName as varchar(50)='Pathak'
SELECT COALESCE(@FirstName, @LastName) COALESCE_Example
I hope it will help you out.
Cheers,
ved pathak
Comments