MS-SQL 错误: The offset specified in a OFFSET clause may not be negative
2014-02-15 17:52
1136 查看
Example 1 : (Fetch clause must be greater than zero)
USE AdventureWorks2012
GO
SELECT
*
FROM
[HumanResources].[vEmployee]
ORDER
BY
[JobTitle]
OFFSET 10
ROWS
FETCH
NEXT
0
ROWS
ONLY
--OUTPUT
Msg 10744, Level 15, State 1, Line 4
The number of rows provided for a FETCH clause must be greater then zero.
Example 2 : (Offset clause must have integer only)
USE AdventureWorks2012
GO
SELECT
*
FROM
[HumanResources].[vEmployee]
ORDER
BY
[JobTitle]
OFFSET 1.1
ROWS
FETCH
NEXT
10
ROWS
ONLY
--OUTPUT
Msg 10743, Level 15, State 1, Line 3
The number of rows provided for an OFFSET clause must be an integer.
Example 3 : (Offset clause may not be negative)
USE AdventureWorks2012
GO
SELECT
*
FROM
[HumanResources].[vEmployee]
ORDER
BY
[JobTitle]
OFFSET -10
ROWS
FETCH
NEXT
10
ROWS
ONLY
--OUTPUT
Msg 10742, Level 15, State 1, Line 3
The offset specified in an OFFSET clause may not be negative.
Example 4 : (A Top cannot be used in the same query or sub query as an offset.)
USE AdventureWorks2012
GO
SELECT
Top
5 *
FROM
[HumanResources].[vEmployee]
ORDER
BY
[JobTitle]
OFFSET 10
ROWS
FETCH
NEXT
10
ROWS
ONLY
--OUTPUT
Msg 10741, Level 15, State 2, Line 2
A TOP cannot be used in the same query or sub-query as an OFFSET.
原文: http://raresql.com/tag/the-offset-specified-in-a-offset-clause-may-not-be-negative/
相关文章推荐
- 编译错误:A class file was not written. The project may be inconsistent, if so try refreshing this projec
- PLS-00231错误:function name may not be used in SQL
- A class file was not written. The project may be inconsistent, if so try refreshing this project and building it. eclipse提示错误
- A class file was not written. The project may be inconsistent, if so try refreshing this project and building it. eclipse提示错误
- Maven错误:was cached in the local repository, resolution will not be reattempted until the update
- mac上 go-delve 安装出现The specified item could not be found in the keychain 解决方法
- 关于The function get must be used with a prefix when a default namespace is not specified的错误
- [Solved]: System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use.
- [Eclipse问题]A class file was not written. The project may be inconsistent
- A class file was not written. The project may be inconsistent
- Claims系列 - ID3206错误 (A signin response may only redirect within the current web application: (url) is not allowed)
- java.sql.SQLException: The SQL statement must not be null or empty.这个错误
- Ubuntu报“xxx is not in the sudoers file.This incident will be reported” 错误解决方法
- A class file was not written. The project may be inconsistent, if so try refreshing this project and
- "不是所有工作区中的窗口无法打开"错误消息(Not all of the Windows in the workspace could be open)
- codeblocks中Error:new types may not be defined in a return type错误
- Hive学习2_错误: The specified datastore driver ("com.mysql.jdbc.Driver") was not found in the CLASSPATH
- Ubuntu报“xxx is not in the sudoers file.This incident will be reported” 错误解决方法
- from scipy import spatial 出现 from .qhull import * ImportError: DLL load failed: The specified module could not be found. 错误
- JQuery 错误提示:HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy