SQL dbvisualizer:在选择查询中设置最大行数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8419088/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
dbvisualizer: set max rows in a select query
提问by HelloWorld
I am using DBVisualizer 8.0.6 and when I run a simply query like....
我正在使用 DBVisualizer 8.0.6,当我运行一个简单的查询时......
select * from table
It only shows the first 1000 rows and then stops the query and displays in the bottom left corner... "Number of rows limited by maxrows"
它只显示前 1000 行,然后停止查询并显示在左下角...“受 maxrows 限制的行数”
How do I change this #? I'm writing a query which needs to export a little over 1000 rows but dbvisualizer has this set limit...
我如何改变这个#?我正在编写一个需要导出超过 1000 行的查询,但 dbvisualizer 有这个限制......
I tried something like @set maxrows 2000 then commit then run my query. Still returns only 1000 rows. This is for an Oracle table.
我尝试了类似 @set maxrows 2000 然后提交然后运行我的查询。仍然只返回 1000 行。这是针对 Oracle 表的。
回答by James Allman
There is a box in SQL Commander labeled Max Rows. Set it to -1
for the complete result set.
SQL Commander 中有一个标记为 Max Rows 的框。将其设置-1
为完整的结果集。
回答by MatthiasDS
Or you could just export directly to a file. This will allow to export many more rows than the DBVisualizer GUI can show you. When having to export a few million records (should you ever need that), this is quite useful.
或者您可以直接导出到文件。这将允许导出比 DBVisualizer GUI 可以显示的更多的行。当必须导出几百万条记录时(如果您需要的话),这非常有用。
Simply do something like this in your SQL Commander:
只需在您的 SQL Commander 中执行以下操作:
@export on;
@export set Filename="d:\temp\export" format="CSV" DecimalNumberFormat="00000000000" CsvRowDelimiter="\r\n" CsvIncludeColumnHeader="false";
SELECT YOURFIELD FROM YOURTABLE WHERE SOMEFIELD = AFILTERVALUE;
You can find more about this (and the various parameters) here: http://www.dbvis.com/products/dbvis/doc/7.1/doc/ug/sqlCommander/sqlCommander.html#mozTocId448386
您可以在此处找到有关此(以及各种参数)的更多信息:http: //www.dbvis.com/products/dbvis/doc/7.1/doc/ug/sqlCommander/sqlCommander.html#mozTocId448386
回答by HelloWorld
so apparently you need to have DBVisualizer Personal edition to set the maxrows, which the free edition doesn't support. You can get a free trial though. Then you can run something like...
所以显然你需要有 DBVisualizer 个人版来设置最大行数,免费版不支持。不过,您可以获得免费试用。然后你可以运行类似...
@set maxrows 2000;
select * from table;
If anyone knows how to do this in the free version please feel free to comment, thanks.
如果有人知道如何在免费版本中执行此操作,请随时发表评论,谢谢。
回答by Davut Gürbüz
select * from table where rownum < 10
would return 9 records for oracle.
select * from table where rownum < 10
将为 oracle 返回 9 条记录。
But It varies db to db .
但它从 db 到 db 不同。
Sql server uses select top N fieldName from table
.
Sql 服务器使用select top N fieldName from table
.
For MySQL syntax changes as SELECT *FROM table LIMIT N
对于 MySQL 语法更改为 SELECT *FROM table LIMIT N
Maybe Some others use take , skip, etc... So using dbvisualizer , and its setting in the accepted answer is logical for cross db users. It doesn't bother you by varied sql syntax.
也许其他一些人使用 take , skip 等......所以使用 dbvisualizer ,它在接受的答案中的设置对于跨数据库用户来说是合乎逻辑的。它不会因不同的 sql 语法而困扰您。