Should I use != or <> for not equal in T-SQL?

前端 未结 14 1845
失恋的感觉
失恋的感觉 2020-11-22 04:23

I have seen SQL that uses both != and <> for not equal. What is the preferred syntax and why?

14条回答
  •  旧时难觅i
    2020-11-22 04:55

    Technically they function the same if you’re using SQL Server AKA T-SQL. If you're using it in stored procedures there is no performance reason to use one over the other. It then comes down to personal preference. I prefer to use <> as it is ANSI compliant.

    You can find links to the various ANSI standards at...

    http://en.wikipedia.org/wiki/SQL

提交回复
热议问题