"~" part? Does tilde (~) has a special mea..." /> "~" part? Does tilde (~) has a special mea..." /> "~" part? Does tilde (~) has a special mea..."/>

What does <> "~" mean in SQL

23.5k views Asked by At

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?

2

There are 2 answers

2
Ashish Gaur On BEST ANSWER

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.

0
Stanic On

All SQL server versions after 2014 supports '~' operator, its bitwise not operator. I use it mostly to invert value of some flags (bit columns) in my DB. You can see more here.