Not Null in Azure Sql DB

Rohit Kulkarni 731 Reputation points
2021-06-23T11:09:19.84+00:00

Hello Team,

I have created a table in Azure SQL DB and mentioned as Null to all the values :

108632-image.png

Once I run the query The Null Value is displaying in Previous_RM_ID and Previous_TM_ID field.
It must display as a Blank .

108600-image.png

Please advise .

Thanks in adavcne

Regards
RK

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,373 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Olaf Helper 47,436 Reputation points
    2021-06-23T11:22:11.893+00:00

    You defined the column as nullable and when you don't insert data for the column then query returns NULL as value; that's how nullable columns work.

    If you want NULL as blank in a query, then you can use the ISNULL function to retunr blank instead, like

    SELECT ISNULL(Previous_RM_ID, '') AS Previous_RM_ID, ...
    

    or you define the column as not-nullable with blank as default value, like

    ...,Previous_RM_ID nvarchar(255) NOT NULL DEFAULT(''), ...
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.