What is the difference between != and <>Operator in SQL Server as both of them works same for Not Equal To Operator?
Very interesting question indeed. Even though this looks very simple when I asked quite a few people if they know the answer before I decided to blog about it. The answer which I received was that it seems that many know the answer but everybody wanted to know the more about it.
Here is the answer – Technically there is no difference between != and <>. Both of them work the same way and there is absolutely no difference in terms of performance or result.
Here is the follow up question I received right I answer that there is no difference between those operator.
If != and <> both are the same, which one should be used in SQL queries?
Here is the answer – You can use either != or <> both in your queries as both technically same but I prefer to use <> as that is SQL-92 standard.
Though, many of the leading database applications supports both of the operators. For example -
- SQL Server
- IBM Informix
Here is my return question to you which one of the following operators you use for NOT EQUAL TO operation?
Please leave your answer with reason in comment field and I will publish the interesting answer as a follow up blog post with due credit.
Reference: Pinal Dave (http://blog.sqlauthority.com)