SQL-Server-First-Responder-Kit icon indicating copy to clipboard operation
SQL-Server-First-Responder-Kit copied to clipboard

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

Open francescovista opened this issue 9 years ago • 4 comments

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

francescovista avatar Aug 15 '17 04:08 francescovista

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+.

rdameron avatar Aug 15 '17 14:08 rdameron

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 avatar Aug 15 '17 21:08 francescovista

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)

francescovista avatar Aug 15 '17 21:08 francescovista

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.

BlitzErik avatar Aug 15 '17 22:08 BlitzErik