SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
………………
………………
GO
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
这些是 SQL-92 设置语句,使 SQL Server 2000/2005 遵从 SQL-92 规则。
当 SET QUOTED_IDENTIFIER 为 ON 时,标识符可以由双引号分隔,而文字必须由单引号分隔。当 SET QUOTED_IDENTIFIER 为 OFF 时,标识符不可加引号,且必须符合所有 Transact-SQL 标识符规则。
SQL-92 标准要求在对空值进行等于 (=) 或不等于 (<>) 比较时取值为 FALSE。当 SET ANSI_NULLS 为
ON 时,即使 column_name 中包含空值,使用 WHERE column_name = NULL 的 SELECT
语句仍返回零行。即使 column_name 中包含非空值,使用 WHERE column_name <> NULL 的
SELECT 语句仍会返回零行。
当 SET ANSI_NULLS 为 OFF 时,等于 (=) 和不等于 (<>) 比较运算符不遵从 SQL-92 标准。使用
WHERE column_name = NULL 的 SELECT 语句返回 column_name 中包含空值的行。使用 WHERE
column_name <> NULL 的 SELECT 语句返回列中包含非空值的行。此外,使用 WHERE column_name
<> XYZ_value 的 SELECT 语句返回所有不为 XYZ_value 也不为 NULL 的行。
分享到:
相关推荐
SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO ALTER PROCEDURE test @From varchar(100)="zhang.zhanling@itgemini.net" , @To varchar(100)="zhang.zhanling@itgemini.net" ,@eng varchar(1000)=" ", ...
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[stuinf]( [name] [nchar](20) NOT NULL, [telephone] [nchar](50) NULL, [mobilepho] [nchar](50) NULL, [qq] [nchar](50) NULL, ...
SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[Param_City]( [id] [int] IDENTITY(1,1) NOT NULL, [parentid] [int] NULL, [City] [varchar](250) NULL, [Create_id] [int] NULL, ...
`SET QUOTED_IDENTIFIER ON/OFF` 则影响标识符(如表名或列名)是否需要引号包裹。 3. **SQL SET ConnectAttr**:在某些数据库系统中,如Oracle,可以通过`ALTER SESSION SET`来改变连接的属性,比如设置会话的时区...
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[diaryclass]( [id] [int] IDENTITY(1,1) NOT NULL, [classname] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT [PK_...
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[gbook_class]( [id] [int] IDENTITY(1,1) NOT NULL, [classname] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL, CONSTRAINT [PK_gbook...
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[Student]( [Id] [int] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](50) NULL, [Age] [int] NULL, [Grade] [nvarchar](50) NULL, [Sex] ...
exec sp_dboption N'My_vehicle', N'quoted identifier', N'false' GO exec sp_dboption N'My_vehicle', N'ANSI warnings', N'false' GO exec sp_dboption N'My_vehicle', N'auto create statistics', N'true' GO ...
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[uMessage]') AND type in (N'U')) BEGIN CREATE TABLE [dbo].[uMessage]( [id...
ALTER DATABASE [MyHotel] SET QUOTED_IDENTIFIER OFF GO ALTER DATABASE [MyHotel] SET RECURSIVE_TRIGGERS OFF GO ALTER DATABASE [MyHotel] SET ENABLE_BROKER GO ALTER DATABASE [MyHotel] SET AUTO_UPDATE_...
Extjs动态加载树,首先在数据库里面设计存放树信息的表 代码如下: USE [KimiExtjs] GO /****** 对象: Table [dbo].[Trees] 脚本日期: 04/08/2010 22:12:25 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON ...
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO CREATE TABLE [dbo].[Book] ( [id] [int] NOT NULL, [name] [varchar](50) COLLATE Chinese_PRC_CI_AS NULL, [password] ...
整理了一下SQL Server里面可能经常会用到的日期格式转换方法,整合一个函数来处理。 调用: select dbo.func_Print_DateFormat...SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO /* 日期格式处理 日期:2015-8-28 1
参考网址 //www.jb51.net/article/29551.htm 代码如下: SELECT [StartDate] FROM [dbo].[udf_Week](2012,2012) ... 代码如下: udf_StartDateOfFirstWeek SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE FU
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --创建分页存储过程 CREATE PROCEDURE [dbo].[pro_GetPagedData] @pageIndex INT,--输入参数,页号 @pageSize INT,--输入参数,每页容量 @rowCount INT OUTPUT...
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[CancelOrderBySystem] AS BEGIN declare /*声明变量*/ @Status varchar(100), –状态 @TimeNow datetime, –当前时间 @...
代码如下: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER FUNCTION [dbo].[udf_OrderLimitSize] ( @Ov NVARCHAR(30) ) RETURNS decimal(18,6) AS BEGIN –如果长度少于等于2的数值为返回NULL IF (LEN(@...
文件:.wmv;大小:19,535KB;长度:00:26:39。... 就此bug对此函数修改如下: 代码如下: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER FUNCTION [dbo].[udf_Week] ( @StartYear INT, @EndYear
代码如下: CalNumOfChtInStr SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO — ============================================= — Author: Insus.NET — Create date: 2012-02-23 — Description: Calculate ...