I inherited a database that lives in a SQL Server Express instance and realized it wasn't getting backed up. Since it is SQL Server Express and there isn't a SQL Server Agent, I found this article describing how to automate backups. https://support.microsoft.com/en-us/help/2019698/how-to-schedule-and-automate-backups-of-sql-server-databases-in-sql-se
The backup script works correctly and I can run the stored procedure successfully from SQL Server Management Studio to create the backups. My trouble starts at Step B, using sqlcmd
.
No matter what I do, it just errors saying
Could not find stored procedure 'dbo.sp_backupDatabases'
The stored procedure exists in the master DB:
Also, I tested running the command using one of the system stored procedures, and it executes those fine as well. It just can't seem to find this custom stored procedure I created.
I've also run this command:
select * from information_schema.routines
and my stored procedure is found in one of the records.
Any help is appreciated!
It looks like an issue with name resolution. I would try to skip database/schema name i.e:
EXEC sp_backupDatabases ...