{"id":781,"date":"2012-12-08T11:34:52","date_gmt":"2012-12-08T03:34:52","guid":{"rendered":"http:\/\/www.vcoo.cc\/blog\/?p=781"},"modified":"2012-12-08T11:34:52","modified_gmt":"2012-12-08T03:34:52","slug":"sql-set-ansi_nulls","status":"publish","type":"post","link":"https:\/\/vcoo.cc\/blog\/781\/","title":{"rendered":"SQL\u4e2dSET ANSI_NULLS ON\u7684\u542b\u4e49"},"content":{"rendered":"<p>SQL-92 \u6807\u51c6\u8981\u6c42\u5728\u5bf9\u7a7a\u503c\u8fdb\u884c\u7b49\u4e8e (=) \u6216\u4e0d\u7b49\u4e8e (&lt;&gt;) \u6bd4\u8f83\u65f6\u53d6\u503c\u4e3a FALSE\u3002\u5f53 SET ANSI_NULLS \u4e3a ON \u65f6\uff0c\u5373\u4f7f column_name \u4e2d\u5305\u542b\u7a7a\u503c\uff0c\u4f7f\u7528 WHERE column_name = NULL \u7684 SELECT \u8bed\u53e5\u4ecd\u8fd4\u56de\u96f6\u884c\u3002\u5373\u4f7f column_name \u4e2d\u5305\u542b\u975e\u7a7a\u503c\uff0c\u4f7f\u7528 WHERE column_name &lt;&gt; NULL \u7684 SELECT \u8bed\u53e5\u4ecd\u4f1a\u8fd4\u56de\u96f6\u884c\u3002<\/p>\n<p>\u5f53 SET ANSI_NULLS \u4e3a OFF \u65f6\uff0c\u7b49\u4e8e (=) \u548c\u4e0d\u7b49\u4e8e (&lt;&gt;) \u6bd4\u8f83\u8fd0\u7b97\u7b26\u4e0d\u9075\u4ece SQL-92 \u6807\u51c6\u3002\u4f7f\u7528 WHERE column_name = NULL \u7684 SELECT \u8bed\u53e5\u8fd4\u56de column_name \u4e2d\u5305\u542b\u7a7a\u503c\u7684\u884c\u3002\u4f7f\u7528 WHERE column_name &lt;&gt; NULL \u7684 SELECT \u8bed\u53e5\u8fd4\u56de\u5217\u4e2d\u5305\u542b\u975e\u7a7a\u503c\u7684\u884c\u3002\u6b64\u5916\uff0c\u4f7f\u7528 WHERE column_name &lt;&gt; XYZ_value \u7684 SELECT \u8bed\u53e5\u8fd4\u56de\u6240\u6709\u4e0d\u4e3a XYZ_value \u4e5f\u4e0d\u4e3a NULL \u7684\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL-92 \u6807\u51c6\u8981\u6c42\u5728\u5bf9\u7a7a\u503c\u8fdb\u884c\u7b49\u4e8e (=) \u6216\u4e0d\u7b49\u4e8e (<>) \u6bd4\u8f83\u65f6\u53d6\u503c\u4e3a FALSE\u3002\u5f53 SET ANSI_NULLS \u4e3a ON \u65f6\uff0c\u5373\u4f7f column_name \u4e2d\u5305\u542b\u7a7a\u503c\uff0c\u4f7f\u7528 WHERE column_name = NULL \u7684 SELECT \u8bed\u53e5\u4ecd\u8fd4\u56de\u96f6\u884c\u3002\u5373\u4f7f column_name \u4e2d\u5305\u542b\u975e\u7a7a\u503c\uff0c\u4f7f\u7528 WHERE column_name <> NULL \u7684 SELECT \u8bed\u53e5\u4ecd\u4f1a\u8fd4\u56de\u96f6\u884c\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[45,44,46],"class_list":["post-781","post","type-post","status-publish","format-standard","hentry","category-sql-server","tag-server","tag-sql","tag-46","cat-11-id"],"_links":{"self":[{"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/posts\/781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/comments?post=781"}],"version-history":[{"count":0,"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/posts\/781\/revisions"}],"wp:attachment":[{"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/media?parent=781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/categories?post=781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vcoo.cc\/blog\/wp-json\/wp\/v2\/tags?post=781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}