判断变量是否为null要用is null的
如下:
CREATE procedure lianxi
@transtype varchar(20) ,
@cabit_32 varchar(20) = null
as
if @cabit_32 is null
begin
select * from zhilian
end
else
begin
select * from zhilian
where transtype = @transtype
end
GO
CREATE or REPLACE procedure lianxi
@transtype varchar(20) ,
@cabit_32 varchar(20) = ''
as
if @cabit_32 = ''
begin
select * from zhilian
end
else
begin
select * from zhilian where transtype = @transtype
end
GO