
正文
sqlserver的判空,sqlserver 判断空值
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
sqlserver2000中判空
where a is null
不是用等号,是用关键字"is"
不为空就是 is not null
相关问答
Q1: SQLServer 有SQL语句 怎么判断一列(很多可以为空的字段)值中有空值或者为NUll
在sql中
空值有NULL 和''的形式
当是NULL的时候用 IS NULL判断
当是''的时候用 =''判断
比如
select * from table where enddate IS NULL;
select * from table where str='';
Q2: SQLSERVER触发器判断非空值
create trigger DataProarea on testtable
for insert as
if exists(select * from inserted where TestFileds is null)
BEGIN
PRINT 'TestFileds是空值!'
ROLLBACK TRANSACTION
END
ELSE if not exists(select * from inserted join peopletable on inserted.TestFileds=peopletable.Peoplefileds)
begin
PRINT 'TestFileds的值在peopletable表的Peoplefileds中不存在!'
ROLLBACK TRANSACTION
end
GO






