create procedure P_News
@news_types int,
@area varchar(100)
asif (@area = '')
begin
select id
,title
,stime
from news
where news_type = @news_types
order by id desc
end
else
begin
select id,title,stime from news
where news_type = @news_types and area = @area
order by id desc
end 调用:
rs.open "P_NEWS "&news_type&",'"&'session("area")&"'",conn,1,1
@news_types int,
@area varchar(100)
asif (@area = '')
begin
select id
,title
,stime
from news
where news_type = @news_types
order by id desc
end
else
begin
select id,title,stime from news
where news_type = @news_types and area = @area
order by id desc
end 调用:
rs.open "P_NEWS "&news_type&",'"&'session("area")&"'",conn,1,1
@news_types int,
@area varchar(100),
@ntop intSQL 语句
select top @ntop id
,title
,stime