惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Cybersecurity and Infrastructure Security Agency CISA
月光博客
月光博客
Apple Machine Learning Research
Apple Machine Learning Research
量子位
Hugging Face - Blog
Hugging Face - Blog
罗磊的独立博客
小众软件
小众软件
T
Tailwind CSS Blog
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
V
Visual Studio Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Exploit Database - CXSecurity.com
T
Tenable Blog
博客园 - 叶小钗
宝玉的分享
宝玉的分享
P
Privacy International News Feed
T
Tor Project blog
博客园_首页
AWS News Blog
AWS News Blog
雷峰网
雷峰网
C
Cisco Blogs
Help Net Security
Help Net Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - 【当耐特】
T
Threat Research - Cisco Blogs
Last Week in AI
Last Week in AI
K
Kaspersky official blog
人人都是产品经理
人人都是产品经理
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
Schneier on Security
博客园 - Franky
W
WeLiveSecurity
L
LINUX DO - 热门话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
爱范儿
爱范儿
酷 壳 – CoolShell
酷 壳 – CoolShell
P
Proofpoint News Feed
大猫的无限游戏
大猫的无限游戏
腾讯CDC
L
Lohrmann on Cybersecurity
J
Java Code Geeks
美团技术团队
博客园 - 司徒正美
The Cloudflare Blog
V
V2EX

博客园 - josephshi

识别文本文件编码 文件分割 合并 小软件 呵呵 APACHE+ASP.NET 出现问题 compiere/adempiere+pgsql8.2+RHEL4+jdk1.5 学习 memcached 地震... Visual Studio 2008 简体中文正式版下载及序列号(无使用期限限制,正式版) How to Write a Provider Model Snap it! - How to take a screen shot using .NET - josephshi 我用hsqldb 找出闰年 "一个特牛的日期时间判断正则表达式"--我的修改版 - josephshi - 博客园 Copy a table from one database to another in SQL Server 2005 个人用Mozilla FIREFOX的感受 RSS阅读量大于页面访问量 美工太差,效果不好看 有点怪怪的 ASP.NET Validation Controls – Important Points, Tips and Tricks Highlight a Row in GridView without a postback using ASP.NET and JavaScript
Retrieving middle rows from a table
josephshi · 2008-04-28 · via 博客园 - josephshi

For retrieving the middle rows of a table irrespective of its columns needs to write a procedure which will take 3 parameters.

First parameter: The first parameter is the query of the particular table with respective column names (if needed or if u know the column details) otherwise u can give the * instead of column names with respective where condition in it, the parameter is of data type TEXT.

Second parameter: This parameter will take int value which is used to take values from the row where you want to start retrieving data.

Third parameter: This parameter also will take int value which is used to take values till which row you want retrieve data.

CREATE PROCEDURE sp_MidRows_Query(@Qry TEXT, @from INT, @to INT)
AS
BEGIN
DROP TABLE ##newTbl
DROP TABLE ##tbl
EXEC('SELECT * INTO ##newTbl FROM ('+@Qry+') temp')
SELECT * INTO ##tbl FROM ##newTbl
ALTER TABLE ##tbl ADD Sno INT IDENTITY(1,1)
SELECT * INTO #tbl FROM ##tbl
SELECT * FROM #tbl WHERE Sno BETWEEN @from AND @to
END

In this procedure Global variable table is used to store the data that is retrieved from the table.

Example for this procedure:

sp_MidRows_Query SELECT * FROM Employee WHERE Salary > 10000 , 4, 9

First parameter is SELECT * FROM Employee WHERE Salary > 10000

Second parameter is 4

Third parameter is 9

This will give the list of employees whose salary is greater than 10000 and also from 4th row to 9th row.