gpt4 book ai didi

sql-server - SQL Server上有没有类似于Oracle的自动限制的属性?

转载 作者:行者123 更新时间:2023-12-03 03:05:52 26 4
gpt4 key购买 nike

我的 table 上有很多记录。有时我会在查询时忘记使用 top 关键字,所以之后等待这么长时间会很烦人。如果不使用 limit 关键字,Oracle 会带来前 500 条记录。 sql 上是否有类似于 Oracle 自动限制的属性或 secret (哇!)?

最佳答案

您可以使用行计数:

SET rowcount 500
<小时/>

SET ROWCOUNT overrides the SELECT statement TOP keyword if the rowcount is the smaller value.

SET ROWCOUNT is ignored in INSERT, UPDATE, and DELETE statements when an explicit TOP expression is used in the same statement. This includes statements in which INSERT is followed by a SELECT clause.

The setting of SET ROWCOUNT is set at execute or run time and not at parse time.

<小时/>

要关闭此选项以便返回所有行,请指定SET ROWCOUNT 0

有关更多信息,请查看here !

关于sql-server - SQL Server上有没有类似于Oracle的自动限制的属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8878596/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com