CREATE proc resultrows
(
@pagesize int,
@sqlstring nvarchar(4000),
@pagecount int,
@columnid varchar(255),
@columnsort varchar(255)
)
as
declare @str nvarchar(4000)
set @str=' select top '+cast(@pagesize as varchar)+' * from ('+@sqlstring+') T where T.'+@columnid+'
not in
(select top '+cast(((@pagesize)*(@pagecount-1)) as varchar(20)) +' '+@columnid+' from ('+@sqlstring+') T9 order by '+@columnsort+' asc)
order by '+@columnsort+' asc'
--print @str
exec (@str)
GO
存储过程执行正常.但是在用代码调用的时候老是出现 在关键字 'from' 附近有语法错误执行不下去了呀,高手请解答.
------解决方案--------------------------------------------------------
检查下你传进来的@sqlstring。