2

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

Behavior of both operator is same. But i want to know about What is difference between operater != and <> in SQL Server?

Community
  • 1
  • 1
RAKESH HOLKAR
  • 2,127
  • 5
  • 24
  • 42
  • One is ANSI one isn't. Duplicate... – Martin Smith Jun 22 '12 at 11:08
  • @MartinSmith: I thinks the question differs in that the OP asks on what is the fundamental difference between the operators rather than which one to use. – mankand007 Jun 22 '12 at 11:11
  • @mankand007 - There is no fundamental difference. They are functionally identical. This question is basically a sub question of the other. if there were any fundamental difference it would be addressed there. – Martin Smith Jun 22 '12 at 11:13
  • It's quite easy to find the difference in the docs ... http://msdn.microsoft.com/en-us/library/ms190296.aspx Took 10secs to find. I don't see the point of asking it here. – Stefan Steinegger Jun 22 '12 at 11:42

3 Answers3

3

Technically both != and <> are same. Even if you use them in stored procedures also they will behave same in terms of performance. As a SQL standard you should prefer <>.

NOTE: != operator is not standard SQL.

Community
  • 1
  • 1
Jainendra
  • 24,713
  • 30
  • 122
  • 169
2

They are equivalent. The only difference is that the <> is ISO standard, the != is not.

Check out this link: http://msdn.microsoft.com/en-us/library/ms188074.aspx

Stelian Matei
  • 11,553
  • 2
  • 25
  • 29
0

a <> b basically checks that a is either less than or greater than b; i.e, not equal to b. I believe both a and b are converted to their ascii values and then compared.

mankand007
  • 952
  • 2
  • 10
  • 22