select top 700 * from objectaer work only in sqlserver 2005 but 2008

不羁的心 提交于 2019-12-25 01:53:54

问题


how can I select the last 700 entry in my access databse? I'm using this

    private string strsqlcommandBeta = "select top 700 * from objectaer  " +
    " order by objectdate desc" +
    "  ";

but I'm getting this error

The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.


回答1:


The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.

Typically this is a result of using a keyword as a field name in one of your tables, or as an alias in your query. If you don't "quote" the keyword-as-a-field-name with [] you'll get an error.

Although I can't see any keywords being used inappropriately in your query, try this:

SELECT TOP 700 * FROM [objectaer] ORDER BY [objectdate] DESC

It's also possible that the problem is not with your query, rather if objectaer is a query object you've created in Access that contains incorrect syntax, you're likely seeing the error for objectaer instead.




回答2:


Try "Limit 700" at the end

Select * from bla bla bla Limit 700


来源:https://stackoverflow.com/questions/8016658/select-top-700-from-objectaer-work-only-in-sqlserver-2005-but-2008

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!