BrentOzarULTD / SQL-Server-First-Responder-Kit

sp_Blitz, sp_BlitzCache, sp_BlitzFirst, sp_BlitzIndex, and other SQL Server scripts for health checks and performance tuning.
http://FirstResponderKit.org
Other
3.33k stars 991 forks source link

sp_foreachdb.sql: Procedure or function 'sp_foreachdb' expects parameter '@command', which was not supplied. #1065

Closed francescovista closed 7 years ago

francescovista commented 7 years ago

Do you want to request a feature or report a bug?

BUG for sp_foreachdb.sql

What is the current behavior?

When installing the stored procedure on a new instance of SQL Server 2016 I have:

Msg 201, Level 16, State 4, Procedure sp_foreachdb, Line 0 [Batch Start Line 0]
Procedure or function 'sp_foreachdb' expects parameter '@command', which was not supplied.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via http://sqlfiddle.com

Just run sp_foreachdb.sql on a new instance of SQl Server 2016

What is the expected behavior?

Stored procedure should install

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?

SQL Server 2016 Windows10

rdameron commented 7 years ago

What's the SQL Server build number on your machine? It installs successfully on mine running SQL Server 13.0.4410.0. This is SP1+.

francescovista commented 7 years ago

Microsoft SQL Server Management Studio 13.0.16106.4 Microsoft Analysis Services Client Tools 13.0.1700.441 Microsoft Data Access Components (MDAC) 10.0.15063.0 Microsoft MSXML 3.0 4.0 6.0 Microsoft Internet Explorer 9.11.15063.0 Microsoft .NET Framework 4.0.30319.42000 Operating System 6.3.15063

francescovista commented 7 years ago

Microsoft SQL Server 2016 (SP1-CU2) (KB4013106) - 13.0.4422.0 (X64) Mar 6 2017 14:18:16 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows 10 Enterprise 6.3 (Build 15063: ) (Hypervisor)

BlitzErik commented 7 years ago

This will happen if you don't set @command to anything. This isn't a bug, you need to give it a command to run.