replace null with empty string java Archives - Tech Insights Unveiling Tomorrow's Tech Today, Where Innovation Meets Insight Thu, 28 Sep 2023 06:10:52 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://i0.wp.com/reactconf.org/wp-content/uploads/2023/11/cropped-reactconf.png?fit=32%2C32&ssl=1 replace null with empty string java Archives - Tech Insights 32 32 230003556 Replace Null with Empty String in SQL Using Coalesce | ISNULL function https://reactconf.org/replace-null-with-empty-string-in-sql-using-coalesce-isnull-function/ https://reactconf.org/replace-null-with-empty-string-in-sql-using-coalesce-isnull-function/#respond Thu, 28 Sep 2023 06:10:52 +0000 http://www.sqlneed.com/?p=493 Replacing Null values with Empty strings or other custom values in SQL using ‘Coalesce()’ and ‘ISNULL()’ functions. In this article, we will learn How to Replace Null with Empty String …

The post Replace Null with Empty String in SQL Using Coalesce | ISNULL function appeared first on Tech Insights.

]]>
Replacing Null values with Empty strings or other custom values in SQL using ‘Coalesce()’ and ‘ISNULL()’ functions. In this article, we will learn How to Replace Null with Empty String in SQL Using Coalesce | ISNULL function.

Coalesce Function

The COALESCE() function can take multiple arguments and return the first non-null value from the list of arguments. For example:

Select coalesce(null,'Hight',null,'Low') as 'coalesce function' 

The above query returns the second value because it considers the second value as the first value that isn’t null.

Replace Null with Empty String Using Coalesce Function

-- Replace Null with Empty string
select Company,[First Name],[Last Name], coalesce([E-mail Address],'') as email from [dbo].[Customers]

-- Replace Null with custom value
select Company,[First Name],[Last Name], coalesce([E-mail Address],'Email address missing') as email from [dbo].[Customers]

Result:

Replace Null with Empty String in SQL Using Coalesce | ISNULL function

ISNULL Function

The ISNULL() function takes two arguments. It returns the not null value first. For example

Select ISNULL('Hight',null) as 'ISNULL function' 

Replace Null with Empty String Using ISNULL Function

select Company,[First Name],[Last Name], ISNULL([E-mail Address],'') as email from [dbo].[Customers]

Result

The post Replace Null with Empty String in SQL Using Coalesce | ISNULL function appeared first on Tech Insights.

]]>
https://reactconf.org/replace-null-with-empty-string-in-sql-using-coalesce-isnull-function/feed/ 0 2263