不是拼SQL语句的页面存储过程
ALTER PROCEDURE [dbo].[GetUsersList]
@BigClassID int=0,--大类别ID
@SmallClassID int=0 ,--小类别ID
@pageindex int=1,
@pagesize int=3,
@ret int output --共几条
AS
set rowcount @pagesize
if @SmallClassID>0
begin
select * from(
select id,BigClassName,SmallClassName,UserName,Corporation,rank() over(order by id desc) as rownumber from Users where BigClassID=@BigClassID and SmallClassID=@SmallClassID
)t where t.rownumber>(@pageindex-1)*@pagesize;
set @ret=(select count(id) from Users where BigClassID=@BigClassID and SmallClassID=@SmallClassID);
end
else
begin
select * from(
select id,BigClassName,SmallClassName,UserName,Corporation,rank() over(order by id desc) as rownumber from Users
)t where t.rownumber>(@pageindex-1)*@pagesize;
set @ret=(select count(id) from Users) ;
end
相关文档:
What is SQL*Plus and where does it come from?
SQL*Plus is a command line SQL and PL/SQL language interface and reporting tool that ships with the Oracle Database Client and Server software. It can be used interactively or driven from scripts. SQL*Plus is frequently used by DBAs and Developers ......
全文搜索的核心引擎建立在Microsoft Full-Text Engine for SQL Server (MSFTESQL) 服务提供支持
面对海量的数据,如何才能找到我需要的?对数百万行文本数据执行的LIKE 查询可能需要花费几分钟时间才能返回结果;但对同样的数据,全文查询只需要几秒或更少 ......
(1) 选择最有效率的表名顺序(只在基于规则的优化器中有效):
ORACLE 的解析器按照从右到左的顺序处理from子句中的表名,from子句中写在最后的表(基础表 driving table)将被最先处理,在from子句中包含多个表的情况下,你必须选择记录条数最少的表作为基础表。如果有3个以上的表连接查询, 那就需要 ......
本文总结了开发工作中常用的SQL语句,供大家参考……
--语 句 功 能
--数据操作
SELECT --从数据库表中检索数据行和列
INSERT --向数据库表添加新数据行
DELETE --从数据库表中删除数据行
UPDATE --更新数据库表中的数据
--数据定义
CREATE TABLE --创建一个数据库表
DROP TABLE --从数据库中删除表
A ......
一、Orcale 时的查询
String hql = "from SmsTemplate t where 1=1 ";
if (model != null && !"".equals(model.getEndTimes())&& null!=model.getEndTimes() ) {
SimpleDateFormat dateFm = new SimpleDateFormat("yyyy-MM-dd"); //格式化当前系统日期
Date ......