日期:2014-05-18 浏览次数:20523 次
if key <> "" and lbid <> "" and isnumeric(lbid) then sql = "select * from market where (info like '%"&key&"%' or bt like '%"&key&"%' or huiyuan like '%"&key&"%' or name like '%"&key&"%') and lbid = " & lbid & " order y ding desc , sj1 desc" elseif key <> "" then sql = "select * from market where info like '%"&key&"%' or bt like '%"&key&"%' or huiyuan like '%"&key&"%' or name like '%"&key&"%' order by ding desc,sj1 desc" elseif lbid <> "" and isnumeric(lbid) then sql = "select * from market where lbid = " & lbid & " order by ding desc,sj1 desc" else sql = "select * from market order by ding desc,sj1 desc" end if
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE getMarketByKeyLbID @key nvarchar(20), @lbid int AS BEGIN SET NOCOUNT ON; if @key is not null and @lbid is not null select * from market where (info like '%'+ @key +'%' or huiyuan like '%'+ @key +'%' or [name] like '%'+ @key +'%') and lbid=@lbid order by ding desc else if @key is not null select * from market where info like '%'+ @key +'%' or huiyuan like '%'+ @key +'%' or [name] like '%'+ @key +'%' order by ding desc, sj1 desc else if @lbid is not null select * from market where lbid=@lbid order by ding desc, sj1 desc else select * from markey order by ding desc, sj1 desc END GO