I have stored procedures with same parameters (server name and date). I want to write a stored procedure and Exec them in that SP (called it SP_All).
CREATE PROCEDURE [dbo].[SP_All]
AS
BEGIN
exec sp_1 @myDate datetime, @ServerName sysname
exec sp_2 @myDate datetime, @ServerName sysname
exec sp_3 @myDate datetime, @ServerName sysname
exec sp_4 @myDate datetime, @ServerName sysname
END
Go
error: Must declare the scalar variable "@myDate".
sp_
prefix for your stored procedures. Microsoft has reserved that prefix for its own use (see Naming Stored Procedures), and you do run the risk of a name clash sometime in the future. It's also bad for your stored procedure performance. It's best to just simply avoidsp_
and use something else as a prefix - or no prefix at all! – Bunting