消息 102,级别 15,状态 1,第 5 行 ')' 附近有语法错误。
create proc usp_GetAllLogsSelect_Pages
@Category int,
@Visible int,
@Uname varchar(50),
@PageSize int,
@PageIndex int
AS
declare @x int,@y int
set @x=(@PageIndex-1)*@PageSize+1
set @y=(@PageIndex)*@PageSize
exec ('select* from(
select ROW_NUMBER() over(order by ReleaseTime desc) as Rownum,
LId,LogName,Abstract,CommentNo,ReadNo,UName,Category,ReleaseTime
from Logs
where Category='+@Category+' and Visible='+@Visible+' and Uname like '+@Uname+')
as log
where Rownum between '+@x+' and ' +@y)
alter proc usp_GetAllLogsSelect_Pages
AS
begin
declare @Category int,
@Visible int,
@Uname varchar(50),
@PageSize int,
@PageIndex int,
@x int,
@y int
set @x=(@PageIndex-1)*@PageSize+1
set @y=(@PageIndex)*@PageSize
exec ('select* from(
select ROW_NUMBER() over(order by ReleaseTime desc) as Rownum,
LId,LogName,Abstract,CommentNo,ReadNo,UName,Category,ReleaseTime
from Logs
where Category='+@Category+' and Visible='+@Visible+' and Uname like '+@Uname+')
as log
where Rownum between '+@x+' and ' +@y)
end
create proc usp_GetAllLogsSelect_Pages
(
@Category int,
@Visible int,
@Uname varchar(50),
@PageSize int,
@PageIndex int
)
AS
declare @x int,@y int
set @x=(@PageIndex-1)*@PageSize+1
set @y=(@PageIndex)*@PageSize
exec ('select* from(
select ROW_NUMBER() over(order by ReleaseTime desc) as Rownum,
LId,LogName,Abstract,CommentNo,ReadNo,UName,Category,ReleaseTime
from Logs
where Category='+@Category+' and Visible='+@Visible+' and Uname like '+@Uname+')
as log
where Rownum between '+@x+' and ' +@y)