sqlstored-procedurestilde

What does <> "~" mean in SQL


I have an SP and part of it states this:

    AND t_phlcm.VAT_FG  <>  "~"

Can you explain the <> "~" part? Does tilde (~) has a special meaning in SQL like % does?


Solution

  • This is an example of simple string comparison which says t_phlcm.VAT_FG must not be equal to "~" character.

    Although ~ can be used with regular expressions in Postgres like this :

    SELECT * FROM table where name ~ '^ABC'

    and is more powerful but is not advised as LIKE(~~) is more fast. Please refer this

    Generally speaking ~ is used to complement an integer or bit like this:

    Update Users Set [Status] = ~[Status] will invert the status of all users.