Thursday, July 08, 2010

sp_MSforeachdb
@command1 {nvarchar(2000)}
, @replacechar {nchar(1)}
, @command2 {nvarchar(2000)}
, @command3 {nvarchar(2000)}
, @precommand {nvarchar(2000)}
, @postcommand {nvarchar(2000)}

Where:

  • @command1 - is the first command to be executed by "sp_MSforeachdb" and is defined as nvarchar(2000)
  • @replacechar - is a character in the command string that will be replaced with the table name being processed (default replacechar is a "?")
  • @command2 and @command3 are two additional commands that can be run against each database
  • @precommand - is a nvarchar(2000) parameter that specifies a command to be run prior to processing any database
  • @postcommand - is also an nvarchar(2000) field used to identify a command to be run after all commands have been processed against all databases.
I have found that in real life the nvarchar(2000) really means 1928.

No comments:

Post a Comment