日期:2014-05-17 浏览次数:20592 次
create proc select_news_where --查询条件新闻
@NewsType varchar(30), --一级栏目名称
@NewsStype varchar(30), --二级栏目名称
@NewsNumber int, --显示条数
@NewsSort bit --排序方式
as
if @NewsSort=1
begin
select top 10 *
from News
where NewsType=@NewsType and NewsStype=@NewsStype
order by NewsTime desc
end
else
begin
select top 10 *
from News
where NewsType=@NewsType and NewsStype=@NewsStype
order by NewsTime asc
end
go
CREATE PROC select_news_where --查询条件新闻
@NewsType VARCHAR(30) , --一级栏目名称
@NewsStype VARCHAR(30) , --二级栏目名称
@NewsNumber INT , --显示条数
@NewsSort BIT --排序方式
AS
IF @NewsSort = 1
BEGIN
SELECT TOP ( @NewsNumber )
*
FROM News
WHERE NewsType = @NewsType
AND NewsStype = @NewsStype
ORDER BY NewsTime DESC
END
ELSE
BEGIN
SELECT TOP ( @NewsNumber )
*
FROM News
WHERE NewsType = @NewsType
AND NewsStype = @NewsStype
ORDER BY NewsTime ASC
END
go