What is not equal to operator in Outsystems SQL widget?

Hi Folks,
Greetings!

Which is the right NOT EQUAL to operator in SQL? Actually I was tried <> and != for comparison condition check but did not get correct result, always fetched result like = (equal) operator.

Can anybody let me know which operator work for NOT EQUAL to condition check?


Thanks

Hi Meer Imtiyaz,

You can use <> .


Can you share a screenshot?

EFreitas wrote:

Hi Meer Imtiyaz,

You can use <> .


Can you share a screenshot?

Hi EFreitas,
Thanks for your reply.

Please see screenshot of SQL query below


Have you added the test value to the Submitted input parameter (on test inputs tab)?

EFreitas wrote:

Have you added the test value to the Submitted input parameter (on test inputs tab)?

Actually it is Id of Static entity which is pass for compare id's of other entity data where this id of static entity is foreign key.


I understood that. But to test the query in Service Studio you need to fill in the test value on Test Inputs.
On SQL query you have 4 tabs (SQL, test inputs, test output, executed sql). I'm referring to the second tab.

Like this:

 

A slightly silly question from my side, but is the input variable type the same as ManagerStatusID?

Do you try this:


SELECT * FROM Customers
WHERE CustomerName NOT LIKE 'a%';

But in this case you want compare Identifiers, so I advise you to see this link:

https://stackoverflow.com/questions/6156979/sql-where-condition-not-equal-to

Cheers,
Nuno Verdasca

Solution

Since this is a foreign key, it may be nullable and you may be dealing with the dreaded SQL three-value logic, caused by NULL values complicating your conditions.


Try the following:


COALESCE(..) should catch NULL values and convert them to 0, allowing for safe use of the <> operator.

Solution

Another thing:

Don't do: SELECT * FROM.

You have a habit of putting: SELECT {TimeSheet}.* FROM.

Sometimes you get errors because of this.

Gonçalo Soares wrote:

Since this is a foreign key, it may be nullable and you may be dealing with the dreaded SQL three-value logic, caused by NULL values complicating your conditions.


Try the following:


COALESCE(..) should catch NULL values and convert them to 0, allowing for safe use of the <> operator.


This worked for me. Thanks Gonçalo Soares


And thanks to all for your good support.