sreenivasa k

sreenivasa k

  • 880
  • 893
  • 34.6k

Migration from Oracle to SQL Server - Null vs Empty Issue

Jun 16 2018 12:05 PM
Hi All,
 
We have converted Oracle database to SQL server database. We are facing issue with null vs blank.
 
Scenario:
 
In oracle:
 
Create table Student (Sno int, FName varchar(20) not null, MName varchar(30) null,
Lname varchar(20) not null)
 
Insert into Student(Sno,Fname,Mname,Lname) values (10,'James' ,'','Clark')
 
Record Inserting into Oracle as Middle name inserting as null even we passed blank value('')
10,James,null,Clark 
 
Record Inserting into SQL Server as Middle name inserting as blank in SQL server (showing empty space in the table, even we have the default constraint)
10,James,,Clark
 
 
we want to handle when blank ('') inserting into SQL table it should be treated as 'null'  which is the similar behavior of Oracle database.
 
Thanks in advance. 
 
 

Answers (2)