!=和<>有什么区别?在SQL Server中 [英] What is difference between != and <> in sql server

查看:313
本文介绍了!=和<>有什么区别?在SQL Server中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Sql Server中的!=<>运算符之间有什么区别?

What is difference between != and <> operators in Sql Server?

因为两者都用作not运算符.例如:

Since both are used as not operator. E.g :

select * from TableName where ColName <> value

select * from TableName where ColName != value

返回相同的值(行).

推荐答案

没有区别.您可以在MSSQL中同时使用两者.

There is no difference. You can use both in MSSQL.

MSSQL文档说:

!=的功能与<>(不等于)比较运算符相同.

!= functions the same as the <> (Not Equal To) comparison operator.

但是<>是在 ANSI 99 SQL标准中定义的,而!=不是.因此,并非所有的数据库引擎都可能支持它,如果您想生成可移植的代码,我建议使用<>.

But <> is defined in the ANSI 99 SQL standard and != is not. So not all DB engines may support it and if you want to generate portable code I recommend using <>.

这篇关于!=和&lt;&gt;有什么区别?在SQL Server中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆