if exists(select*from sysobjects where name='usp_Sea')
drop proc usp_Sea
go
create proc usp_Sea
@name varchar(50)
as
declare @strsql varchar(1000)
set @strsql='select *from StudentsInfo
where ('+@name+' =''''or '+@name +' is null)'
exec(@strsql)
执行exec usp_Sea ''时发生错误消息 102,级别 15,状态 1,第 2 行
'=' 附近有语法错误。
这是什么问题
drop proc usp_Sea
go
create proc usp_Sea
@name varchar(50)
as
declare @strsql varchar(1000)
set @strsql='select *from StudentsInfo
where ('+@name+' =''''or '+@name +' is null)'
exec(@strsql)
执行exec usp_Sea ''时发生错误消息 102,级别 15,状态 1,第 2 行
'=' 附近有语法错误。
这是什么问题
存储过程没错,但调用时不能传递空参数。。按照你这个存储过程的意思,应该传递一个字段名。。怎么能为空呢?