34,575
社区成员
发帖
与我相关
我的任务
分享
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
create procedure [dbo].[P_AdminToDDTJ]
(@startIndex int,
@endIndex int,@tj varchar(200)
)
as
set nocount on
declare @indextable table(id int identity(1,1),nid int)
set rowcount @endIndex
insert into @indextable(nid) select [oId] from [LFDSDB].[dbo].[orderInfo] where @tj order by [oId] desc
SELECT o.[oId]
,o.[oCode]
,o.[money]
,o.[accounts]
,o.[state]
,o.[ip]
,o.[addDate]
,o.[remark]
,o.[userID]
,o.[jyCode]
FROM [LFDSDB].[dbo].[orderInfo] o
inner join @indextable t on
O.[oId]=t.nid
where t.id between @startIndex and @endIndex and @tj order by t.id
set nocount off
RETURN
exec('
declare @indextable table(id int identity(1,1),nid int)
set rowcount @endIndex
insert into @indextable(nid) select [oId] from [LFDSDB].[dbo].[orderInfo] where '+@tj+' order by [oId] desc
SELECT o.[oId]
,o.[oCode]
,o.[money]
,o.[accounts]
,o.[state]
,o.[ip]
,o.[addDate]
,o.[remark]
,o.[userID]
,o.[jyCode]
FROM [LFDSDB].[dbo].[orderInfo] o
inner join @indextable t on
O.[oId]=t.nid
where t.id between '''+@startIndex+''' and '''+@endIndex+' and '+@tj+' order by t.id')