34,594
社区成员
发帖
与我相关
我的任务
分享
create procedure sp_select_area
@id int=null,
@city nvarchar(20)=null,
@is_zx tinyint=null
as
begin
--默认选择所有地区
select * from area
where id=isnull(@id,id)
and city=isnull(@city,city)
and is_zx=isnull(@is_zx,is_zx)
end
go
create procedure sp_select_area
@id int=null,
@city nvarchar(20)=null,
@is_zx tinyint=null
as
begin
--默认选择所有地区
select * from area
where id=isnull(@id,id)
and city=isnull(@city,city)
and is_zx=isnull(@is_zx,is_zx)
end
go
create procedure sp_select_area
@id int,
@city nvarchar(20),
@is_zx tinyint
as
begin
if @id is null
select * from area
else
select * from area where area=@city
end
create procedure sp_select_area
@id int
as
begin
declare @str varchar(1024)
set @str='select * from area where 1=1';
if @id is not null
set @str=@str+' and id='+cast(@id as varchar(4))+'';
exec (@str)
end
create procedure sp_select_area
@id int = null
as
begin
if @id is null
select * from area
else
select * from area where id=@id
end