- The
sp\_MSforeachdb
system stored procedure accepts the @Command parameter which can be issued against all databases. The ‘?’ is used as a placeholder for the database name to issue the same command. - The alternative is to use a cursor to process specific commands against each database.