create procedure aa
@cookies_member bit,
@cookies_allow smallint,
@products_type varchar(100),
@showedid varchar(100)
as
declare @sql varchar(3000)
set @sql='SELECT TOP 4 assId,style_no,id,smallimg,isnew,newtime,Img_Name FROM products where seelevel=''c'' 'if @cookies_member=1
begin
set @sql=@sql+' or seelevel=''b'''
if @cookies_allow=1 then
set @sql=@sql+' or seelevel=''a'''
end
if @products_type='Random'
begin
if @showedid<>''
set @sql=@sql+' and id <>'''+@showedid+''' order by newid()'
else
set @sql=@sql+'ORDER BY NEWID()'
end
else if @products_type='recommend'
begin
if @showedid<>''
set @sql=@sql+' and tj=''yes'' and id <> '''+@showedid+''' ORDER BY NEWID()'
else
....................................你自己改吧!
end
@cookies_member bit,
@cookies_allow smallint,
@products_type varchar(100),
@showedid varchar(100)
as
declare @sql varchar(3000)
set @sql='SELECT TOP 4 assId,style_no,id,smallimg,isnew,newtime,Img_Name FROM products where seelevel=''c'' 'if @cookies_member=1
begin
set @sql=@sql+' or seelevel=''b'''
if @cookies_allow=1 then
set @sql=@sql+' or seelevel=''a'''
end
if @products_type='Random'
begin
if @showedid<>''
set @sql=@sql+' and id <>'''+@showedid+''' order by newid()'
else
set @sql=@sql+'ORDER BY NEWID()'
end
else if @products_type='recommend'
begin
if @showedid<>''
set @sql=@sql+' and tj=''yes'' and id <> '''+@showedid+''' ORDER BY NEWID()'
else
....................................你自己改吧!
end
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货