Posts Tagged ‘SQL Server’

An insufficient number of arguments were supplied for t »

from the MSSQL manual When a parameter of the function has a default value, the keyword "default" must be specified when calling the function in order to get the default value. This behavior is different from parameters with default values in stored procedures in which omitting the parameter also implies the default value. Source: h

两个特别的存储过程 »

简介 sp_msforeachdb 和 sp_msforeachtable 是非常有用的存储过程, 他们允许你遍历SQL Server实例中的全部数据库和表, 并对这些数据库和表执行命令. 我作为一个DBA每天都在使用它们. 两个存储过程都使用问号(?)作为一个置换符. 对于sp_msforeachdb, "?"表示数据库名称, 对于sp_msforeachtable, "?"表示表名称. sp_msforeachdb 示例 #1 - 可以使用以下命令检查实例中的每个数据库: sp_msforeachdb 'dbcc checkdb( ''?'' )' 示例 #2 - 修改实例中所有数据库的所有者为sa. sp_msforeachdb 'IF ''?'' NO