Skip to content

Commit a76fa62

Browse files
authored
#2037 sp_BlitzLock support for AWS RDS (#2038)
Skips update stats with options that RDS doesn't support. Closes #2037.
1 parent 9862095 commit a76fa62

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sp_BlitzLock.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,13 @@ You need to use an Azure storage account, and the path has to look like this: ht
183183
DECLARE @d VARCHAR(40), @StringToExecute NVARCHAR(4000);
184184

185185
CREATE TABLE #t (id INT NOT NULL);
186-
UPDATE STATISTICS #t WITH ROWCOUNT = 100000000, PAGECOUNT = 100000000;
186+
187+
/* WITH ROWCOUNT doesn't work on Amazon RDS - see: https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/2037 */
188+
IF LEFT(CAST(SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS VARCHAR(8000)), 8) <> 'EC2AMAZ-'
189+
AND LEFT(CAST(SERVERPROPERTY('MachineName') AS VARCHAR(8000)), 8) <> 'EC2AMAZ-'
190+
AND LEFT(CAST(SERVERPROPERTY('ServerName') AS VARCHAR(8000)), 8) <> 'EC2AMAZ-'
191+
AND db_id('rdsadmin') IS NULL
192+
UPDATE STATISTICS #t WITH ROWCOUNT = 100000000, PAGECOUNT = 100000000;
187193

188194
/*Grab the initial set of XML to parse*/
189195
SET @d = CONVERT(VARCHAR(40), GETDATE(), 109);

0 commit comments

Comments
 (0)