|
T-SQL Return Empty String Instead Of Null
There are times when we want to return empty strings for column(s) which have NULL values. T-SQL makes this easy with ISNULL function. Two parameters for this function are:
- The column in question
- Replacement value
Here is an example query for Customers table in Northwind database. This query will select Region column from the table and return blank strings where it finds NULL.
SELECT ISNULL(Region,'') FROM Customers
Here is a partial screenshot of the resultset returned. You can see that the value for top rows is blank. These are actually NULL in database.

Leave a Reply
6452 views, 2 so far
today |
Leave a Reply
Get Updates By Email
Popular Post
Tag Cloud
Code Snippets
- Get Current Windows User In C#
- Get Width And Height Of Image In C#
- Get Windows Registry Size With WMI And C#
- Reverse Array Elements Using C#
- Convert Hexadecimal To Number In C#
- Get Free Disk Space Using T-SQL
- SQL Server 2008 – Get All Indexes In A Database
- Get Name Of Current Executing Assembly In C#
- Get CD Or DVD Drive Information Using WMI And C#
- Get Last Row From Table Using LINQ To SQL

