<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SET &#8211; SQLpowered.com</title>
	<atom:link href="https://sqlpowered.com/command-category/set/feed/" rel="self" type="application/rss+xml" />
	<link>https://sqlpowered.com</link>
	<description>SQL Server + BI</description>
	<lastBuildDate>Thu, 02 Feb 2023 07:21:20 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://sqlpowered.com/wp-content/uploads/2020/07/FavIcon-e1594067873682-99x100.png</url>
	<title>SET &#8211; SQLpowered.com</title>
	<link>https://sqlpowered.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>ROWCOUNT</title>
		<link>https://sqlpowered.com/t-sql-commands/rowcount/</link>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Thu, 02 Feb 2023 07:12:29 +0000</pubDate>
				<guid isPermaLink="false">https://sqlpowered.com/?post_type=t-sql-commands&#038;p=5520</guid>

					<description><![CDATA[Setting the SET ROWCOUNT option causes most Transact-SQL statements to stop processing when they have been affected by the specified number of rows. This includes triggers. SET ROWCOUNT 5 SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) N FROM ( VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0) ) a (n) GO -- (5 rows affected) SET ROWCOUNT...]]></description>
										<content:encoded><![CDATA[<p>Setting the SET ROWCOUNT option causes most Transact-SQL statements to stop processing when they have been affected by the specified number of rows. This includes triggers.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="sql">SET ROWCOUNT 5

SELECT
	ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) N
FROM ( VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0) ) a (n)
GO
-- (5 rows affected)</pre>
<p>SET ROWCOUNT overrides the SELECT statement TOP keyword if the rowcount is the smaller value.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="sql">SET ROWCOUNT 5

SELECT TOP(3)
	ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) N
FROM ( VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0) ) a (n)
GO
-- (5 rows affected)

SET ROWCOUNT 5

SELECT TOP(8)
	ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) N
FROM ( VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0) ) a (n)
-- (5 rows affected)</pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
