我这现在是SQL2005写的,运行是对的!但是我网站驾的服务器是SQL2000的。数据导过去在远程服务器运行的时候就报错了,错误是The text, ntext, or image data type cannot be selected as DISTINCT!原因好像是不能用union但是不用这个把结果拼接在一起还能用什么,2005很多语法2000不支持!在2000里这句话应该怎么改!还有提示的错误也怎么改啊,希望高手们帮解答下"select count(id) AS id,'','cContentccontent' AS cContent,'' from comment_news "+
" where news_id= "+news_id+
" union"+
"select * from("+
" SELECT TOP (" + pageSize + ") id,createDate,cContent,usernames FROM comment_news " +
" WHERE news_id="+news_id+" and Id >= "+
"("+
"SELECT min(id) from "+
"(select top ("+pageL+") Id from comment_news WHERE news_id="+news_id+" order by id desc) as a"+
") order by Id) t1 ";
" where news_id= "+news_id+
" union"+
"select * from("+
" SELECT TOP (" + pageSize + ") id,createDate,cContent,usernames FROM comment_news " +
" WHERE news_id="+news_id+" and Id >= "+
"("+
"SELECT min(id) from "+
"(select top ("+pageL+") Id from comment_news WHERE news_id="+news_id+" order by id desc) as a"+
") order by Id) t1 ";
寻找替代方法
如果不行在试
将ntext,text类型
cast(filed as varchar(8000)) 转化下。
content 数据类型是textselect cast(content as varchar(8000)) as content from a 这个得看你数据库的字段定义。