34,590
社区成员
发帖
与我相关
我的任务
分享
if exists(select * from sys.objects where name='up_search')
drop proc up_search
go
create proc up_search
@type varchar(255),@firm varchar(255),@start int,@end int,@pro varchar(255),@city varchar(255)
as
select * from
(select *,ROW_NUMBER() over (order by ccode)as num from CraneInfo
where Ctype=case when @type<>'-1' then @type else Ctype end
and Company=case when @firm<>'-1' then @firm else Company end
and RegionId=case when @pro='-1' then RegionId else
(select SEC_REGION.REGION_ID from SEC_REGION where REGION_ID=case when @city<>'-1' then @city else REGION_ID end) end
) as test where num between @start and @end
if exists(select * from sys.objects where name='up_search')
drop proc up_search
go
create proc up_search
@type varchar(255),@firm varchar(255),@start int,@end int,@pro varchar(255),@city varchar(255)
AS
IF @type<>'-1' AND @firm<>'-1' AND @pro<>'-1' AND @city<>'-1'
BEGIN
WITH CTE AS
(select *,ROW_NUMBER() over (order by ccode)as num from CraneInfo
WHERE Ctype=@type AND Company=@firm
AND RegionId IN (select REGION_ID from SEC_REGION where REGION_ID=@city)
)
SELECT * FROM CTE WHERE num between @start and @end
END
else
begin
SELECT 1 --此处楼主自己写了
end