3 Replies Latest reply: Jul 26, 2012 5:06 AM by Owen Slater RSS

Handle Null value in SQL Statement

CHRISTOPHE AVEROUS
Currently Being Moderated

Hi all,

 

In SAP when you write the query:  Select codebars from oitm where codebars=''

 

SAP retrieve all the record included the null value

 

When you do the same in SQL, SQL retrieve only the record where codebars='' and not the record where codebars is NULL.

If you want to have the same result you have to write: Select isnull(codebars,'') as 'codebars from oitm where isnull(codebars,'')=''

 

Is there a solution to have the same behavior in SQL then in SAP.

I try SET ANSI_NULLS ON on top of my query but without success.

 

Thanks for your help

 

Regards

 

Christophe'

Actions