日期:2014-05-18 浏览次数:20446 次
create Proc Proc_GetName
@BoyPoint int,
@GirlPoint int
as
begin transaction
Declare @sql varchar(1024)
set @sql='elect name as 名单 where 1=1 '
if(@BoyPoint is not null)
begin
set @sql=@sql+'and sex=1 and grade>='+@BoyPoint
end
if(@GirlPoint is not null)
begin
set @sql=@sql='and sex=2 and grade>='+@GirlPoint
end
exec(@sql)
if @@error <>0
begin
rollback transaction
end
else
begin
commit transaction
end