IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[report_1_data]') AND type = 'P')
DROP PROCEDURE [dbo].[report_1_data]
GO
CREATE PROCEDURE report_1_data
@cmpid int,@branchid int,@userdpid int,@userotid int,@useruid int,@tableid varchar(8000),@objids varchar(8000),@pagesize int
AS
BEGIN
 set nocount on 

declare @dataIds table(objid int)
if @objids!='_NONE' and @objids!='_none_' and @objids!='' 
insert into @dataIds(objid)
select value from dbo.fn_split_int(@objids)
if @tableid='tb_report1'
begin
    if @pagesize=10000
    begin
       select cu_id,cu_callname,cu_mobile from mps_login
       return
    end
    if @objids!='_none_'
    begin
       select cu_id,cu_callname,cu_mobile from @dataIds,mps_login where objid=cu_id
       return
    end

end
if @tableid='tb_report4'
begin
    if @pagesize=10000
    begin
       select cu_id,cu_callname,cu_mobile from mps_login where cu_mobile in('18583230560') and cu_callname like '张%'
       return
    end
    if @objids!='_none_'
    begin
       select cu_id,cu_callname,cu_mobile from @dataIds,mps_login where objid=cu_id
       return
    end

end
select 'tb_report3' tableid,* from mps_depart where dp_id=3327


select count(*) as dataCount from mps_login
select cu_id as dataIds from mps_login order by cu_id
select top 1 'tb_report1' tableid ,cu_id,cu_callname,cu_mobile from mps_login order by cu_id


select 'tb_report2' tableid,* from mps_login


select 'okaa' as status


select count(*) as dataCount from mps_login where cu_mobile in('18583230560') and cu_callname like '张%'
select cu_id as dataIds from mps_login where cu_mobile in('18583230560') and cu_callname like '张%' order by cu_id
select top 10 'tb_report4' tableid ,cu_id,cu_callname,cu_mobile from mps_login where cu_mobile in('18583230560') and cu_callname like '张%' order by cu_id


END