数据为空........??什么意思
猜一个create proc Test @a=null
as
select * from T where col=isnull(@a,col)
go
exec test--可指定也可不指定..
猜一个create proc Test @a=null
as
select * from T where col=isnull(@a,col)
go
exec test--可指定也可不指定..
解决方案 »
- sql 2005 ldf和mdf文件 怎么还原到数据库里面
- 远程连接SQL数据库问题 ,急求
- 提两个SQL问题
- 有拆分字符串的好办法么?
- 为什么进不了事件探查器,总是提示SQL不存在或者访问被拒绝?
- 一段SQL问题...求教
- sql 导入导出 dbf数据库
- 如何实现两个表的合并?
- 用VPN联接两台计算机能PING通IP地址,但联不上MSSQL数据库, 以前用ISDN能行, 有什么方法?
- 听说MS出了SQL SERVER2000是中文版,不知道功能如何?它比7.0的功能多什么?我正想学习SQL 不知道应该学那一个版本?
- sqlserver05导入导出问题
- sql与access之间导入导出重复数据,违反主键索引怎么解决?请楼上的高手赐教?
as
select * from T where col=isnull(@a,col)
go
exec test--可指定也可不指定..
insert into tb select 1,'a'
insert into tb select 2,null
insert into tb select 3,'c'
insert into tb select 5,'d'
insert into tb select 5,'d'
insert into tb select 7,'e'
insert into tb select 7,'e'
insert into tb select 8,'f'
insert into tb select 9,'g'create proc pro_tb
as
begin
if exists(select 1 from tb where name is null)
raiserror 50005 N'错误,过程终止'
endexec pro_tb消息 50005,级别 16,状态 1,过程 pro_tb,第 5 行
错误,过程终止
我的web页面上有两个TextBox控件,一个boutton控件.当我单击boutton控件时,就可以把TextBox控件的内容保存到数据库里面。 如果有一个TextBox控件的内容为空,则不能保存. 如何用存储过程实现这个功能.
直接在页面上实现不是更简单?
我的web页面上有两个TextBox控件,一个boutton控件.当我单击boutton控件时,就可以把TextBox控件的内容保存到数据库里面。 如果有一个TextBox控件的内容为空,则不能保存. 如何用存储过程实现这个功能. ---create table tb(id int,name varchar(10))
gocreate proc pro_tb
@col varchar(8000)
as
begin
if isnull(@col,'') = ''
begin
raiserror 50005 N'错误(企图插入一个空值到name列),过程终止'
return
end
else
insert into tb select 1,@colend
goexec pro_tb 'adfadsf'
select * from tb
/*(所影响的行数为 1 行)id name
----------- ----------
1 adfadsf(所影响的行数为 1 行)
*/
exec pro_tb Null
select * from tb
/*
服务器: 消息 50005,级别 16,状态 1,过程 pro_tb,行 10
错误(企图插入一个空值到name列),过程终止
id name
----------- ----------
1 adfadsf(所影响的行数为 1 行)*/
drop proc pro_tb
drop table tb