Sql server 2014分页查询错误 [英] Sql server 2014 paging query error

查看:204
本文介绍了Sql server 2014分页查询错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个vb net 2015 aoolication并且想要访问sql server 2014数据库,我想使用分页但是从sqldataadapter获取错误

1在FETCH语句中无效使用NEXT选项

这里是代码


I have a vb net 2015 aoolication and want to access an sql server 2014 database, I want to use paging but get an error from sqldataadapter
1) invalid usage of the option NEXT in the FETCH statement
here is the code

SELECT        *
FROM    Table_1
ORDER BY id DESC 
OFFSET 0 ROWS 
FETCH NEXT 20 ROWS ONLY





我尝试了什么:



上面的代码但是给出了错误



What I have tried:

the code above but gives errors

推荐答案

你的语句对我来说在SQL Server 2012上运行正常,所以我希望它也适用于SQL 2014(它不受SQL Server 2008的支持,但是从2012年开始。



检查您是否在您认为自己的服务器实例上运行:

Your statement works fine for me, on SQL Server 2012, so I would expect it to work on SQL 2014 as well (it wasn't supported by SQL Server 2008, but was from 2012 onwards.

Check you are running on the server instance you think you are:
SELECT @@VERSION

将返回如下内容:

will return something like this:

Microsoft SQL Server 2012 (SP2-GDR) (KB3194719) - 11.0.5388.0 (X64) 
	Sep 23 2016 16:56:29 
	Copyright (c) Microsoft Corporation
	Express Edition (64-bit) on Windows NT 6.3 <X64> (Build 15063: )

(这是我的回报)。我打赌你正在运行2008 ...

(which is what mine returns). I'm betting you are running 2008...


这篇关于Sql server 2014分页查询错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆