“Select Top 1000 Rows” and “Edit Top 200 Rows” commands

“Select Top 1000 Rows” and “Edit Top 200 Rows” commands

When we perform a right click on a table or view in SQL Server Management Studio (SSMS) Object Explorer, we have found a default commands “Select Top 1000 Rows” and “Edit Top 200 Rows”.

It is cool, useful and comfort functions, great idea from Microsoft! ...but one question, why it’s “1000” and not “10”, why “200” and not “200000”? What, if we want to SELECT less than 1000 rows or all rows, or edit more than 200 rows? 

Of course, we always can perform exists “Select Top 1000 Rows” and after that modify the query. It is a little bit not comfortable and in some cases can be dangerous (busy environment, locks, few times querying and etc).

Is there any preferences option we can change so that the query would appear as we want? Would be nice if we could choose how many rows to receive from the query.

I don’t know why SSMS developers choose 1000 and 200 as default values, but I know how to change it! :)

SSMS > Tools > Options > SQL Server Object Explorer > Table and View Options

Now we can change default values for different value as we desire.

Click OK to save, right click on a table and ...voila, we see a new chosen value.

Specifying of “0” value, will change a default commands to “Select All Rows” and “Edit All Rows”, without any TOP limitation.

Simple and useful :)


---------------------------------------------------

* More information about TOP limitation in Transact-SQL from Microsoft Docs: https://docs.microsoft.com/en-us/sql/t-sql/queries/top-transact-sql

Doug Cassidy

Chief of Web Development and Technical Director at theconneXtion

2 年

Hey, so I was having an issue where I have a table, one of the columns is datetime2(0). If I Select Top 1000 Rows, the dates in theat column show correct, ie: no decimals. If it do Edit Top 200 Rows, it shows 7 numbers after the decimal. That took a lot of wasted time to figure out. Any insight? Thanks, Doug

回复
Guy Orr-Lavan

Cloud Architect | Head of GCP Delivery | DevOps Manager

6 年

Thank you, Very useful.

回复

要查看或添加评论,请登录

Vitaly Bruk的更多文章

社区洞察

其他会员也浏览了