Reputation: 2102
In TSQL is it proper to use != or should one always use <> when doing Boolean comparisons? Is there any difference in performance between the two?
Upvotes: 0
Views: 144
Reputation: 1185
There is absolutely no difference in using != OR <> OPERATORS. In terms of performance, you will see no change. I use <> just to keep me aware of mistake.
Upvotes: 0
Reputation:
No difference just like @marc_s said but if do put it in into SQL server it will just convert it to <>
Just execute the following 2 statements,
SELECT *
FROM sys.databases
WHERE database_id != 1
SELECT *
FROM sys.databases
WHERE database_id <> 1
you will see in Actual execute plan both queries will look like this, and both have same execution plans
SELECT * FROM [sys].[databases] WHERE [database_id]<>@1
Upvotes: 2