首页 新闻 赞助 找找看

SQL 2005 存储过程在2000上怎么改动!

0
悬赏园豆:50 [已关闭问题]

SQL server 2005中这句话对的,怎么改成在2000中正常运行啊,现在在2000中要报错,怎以才能在2000中运行出2005同样的效果?请教高手了!
select  top(@size)  a.idd as typeid,a.tname,a.ordernum,b.idd,b.title,b.pubtime,b.isHot,b.isTop,b.isCommend,b.viewCount,b.lastTime,b.isOutUrl,b.outUrl,imgLink
from newsType_tb as a inner join news_tb as b on a.idd=b.typeid 

cqBlogs的主页 cqBlogs | 初学一级 | 园豆:0
提问于:2009-09-17 19:13
< >
分享
其他回答(2)
0

用一下存储过程。

 

Code
set nocount on
declare @strSQL NvarChar(2000)
set @strSQL = N'SELECT TOP ' + convert(VarChar(12),@size) + ' a.idd as typeid,a.tname,a.ordernum,b.idd,b.title,b.pubtime,b.isHot,b.isTop,b.isCommend,b.viewCount,b.lastTime,b.isOutUrl,b.outUrl,imgLink
FROM newsType_tb as a inner join news_tb as b on a.idd=b.typeid
'
exec sp_executesql @strSQL

  

Kinglee | 园豆:3158 (老鸟四级) | 2009-09-17 19:31
0

存储过程中top后加变量的方法,可以参考这里

http://blog.csdn.net/downmoon/archive/2006/04/12/660557.aspx

http://www.cnblogs.com/downmoon/archive/2007/12/29/1019686.html

邀月 | 园豆:25475 (高人七级) | 2009-09-17 19:32
0

用脚本导出工具:选择类型为Sql2000,系统会自动转换。

winzheng | 园豆:8797 (大侠五级) | 2009-09-18 09:09
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册