高手帮忙看一下,谢了

postfix2 2004-07-09 02:53:11
create proc pagecell
(
@ps1 int,
@ps2 int
)
as
select top @ps1*@ps2+1 * into #tb1 from t_msglog order by l_id asc
select top @ps2 * from #tb1 order by l_id desc


服务器: 消息 170,级别 15,状态 1,过程 pagecell,行 7
第 7 行: '@ps1' 附近有语法错误。怎么的啊
...全文
111 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
Limperator 2004-07-09
  • 打赏
  • 举报
回复
建议微软改进T-SQL, 使更多的地方可以支持变量, 如果能象高级语言那样就好了. 如果是一层的EXEC倒好办, 如果EXEC再嵌套EXEC...调试起来是很郁闷的事情.
大家顶一下啊!:))
ntflying 2004-07-09
  • 打赏
  • 举报
回复
exec('select top ' +cast((@ps1*@ps2+1) as varchar(8000)) +' * into #tb1 from t_msglog order by l_id asc')

Limperator 2004-07-09
  • 打赏
  • 举报
回复
同意szh3210和WangZWang, TOP后面的数字不能是变量, 构造EXEC字串
hudan 2004-07-09
  • 打赏
  • 举报
回复
create proc pagecell
(
@ps1 int,
@ps2 int
)
as
Set rowcount @ps1*@ps2+1
select * into #tb1 from t_msglog order by l_id asc

Set rowcount @ps2
select * from #tb1 order by l_id desc

Set rowcount 0


WangZWang 2004-07-09
  • 打赏
  • 举报
回复
Create proc pagecell
@ps1 int,
@ps2 int
as
Declare @topcount int

Set @topcount=@ps1*@ps2+1

Exec('select top '+@topcount+' * into #tb1
from t_msglog order by l_id asc ')

Exec('select top '+@ps2+' * from #tb1 order by l_id desc ')
postfix2 2004-07-09
  • 打赏
  • 举报
回复
楼上的不对啊??
szh3210 2004-07-09
  • 打赏
  • 举报
回复
exec('select top ' +@ps1*@ps2+1+' * into #tb1 from t_msglog order by l_id asc')
BigGunLee 2004-07-09
  • 打赏
  • 举报
回复
不能再top 后面 用*当乘号
eWebEditor是基于浏览器的、所见即所得的在线HTML编辑器。她能够在网页上实现许多桌面编辑软件(如:Word)所具有的强大可视编辑功能。WEB开发人员可以用她把传统的多行文本输入框