类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
ORACLE里面是这样写的!SQLSERVER2000里面怎么写!急!希望能给改改!谢谢
public String intiQuerySQL(String sql, int startIndex, int size) {
StringBuffer querySQL = new StringBuffer();
if (size != Page.MAX_PAGE_SIZE) {
querySQL.append("select * from (select my_table.*,rownum as my_rownum from(")
.append(sql)
.append(") my_table where rownum<")
.append(startIndex + size)
.append(") where my_rownum>=")
.append(startIndex);
} else {
querySQL.append("select * from (select my_table.*,rownum as my_rownum from(")
.append(sql)
.append(") my_table ")
.append(") where my_rownum>=")
.append(startIndex);
}
return querySQL.toString();
}
网友回答:
在sqlserver中使用TOP rownum就可以实现