Home >Database >Mysql Tutorial > sql server 2005 万能分页存储过程

sql server 2005 万能分页存储过程

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:45:10894browse

sqlserver2005中的万能分页存储过程。建立主表临时表 CREATE TABLE #temp(rownumber bigint,orderseqno VARCHAR(36),goodsname VARCHAR(50),companyname VARCHAR(100))建立子表临 时表CREATE TABLE #detail(orderseqno VARCHAR(36),detailid UNIQUEIDENTIFIE

sqlserver2005中的万能分页存储过程。–建立主表临时表

CREATE TABLE #temp ( rownumber bigint, orderseqno VARCHAR(36), goodsname VARCHAR(50), companyname VARCHAR(100) ) –建立子表临 时表 CREATE TABLE #detail ( orderseqno VARCHAR(36), detailid UNIQUEIDENTIFIER, unitprice DECIMAL(12,2), Qty int ) –插入主表数据到主表临时表 insert into #temp SELECT oo.rownumber, oo.OrderSeqNO, oo.GoodsName, oo.CompanyName FROM (SELECT ROW_NUMBER () OVER (ORDER BY oi.createdate DESC) AS rownumber, oi.OrderSeqNO, oi.GoodsName ,ci.CompanyName FROM OrderInfo oi INNER JOIN CompanyInfo ci ON oi.CompanyID=ci.CompanyID WHERE oi.CreateDate

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article: 数据库设计原则Next article:MS SQL 完全卸载数据库