Bob The Janitor Bob The Janitor - 1 year ago 117
SQL Question

Should I use != or <> for not equal in TSQL?

I have seen SQL that uses both

for not equal. What is the preferred syntax and why?

I like
reminds me of Visual Basic.

Answer Source

Technically they function the same if you’re using MS SQL 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...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download