当前位置:   article > 正文

mysql 不用游标 循环_不用游标来循环访问SQLSERVER数据库对象

mysql 存储过程 循环查询语句结果集 不用游标

Parameters

Type

sp_Msforeachtable

sp_Msforeachdb

Description

@precommand

nvarchar(2000)

Yes

Yes

This command is executed before any commands and can be used for setting up an environment for commands execution.

@command1

nvarchar(2000)

Yes

Yes

First command to be executed against each table/database.

@command2

nvarchar(2000)

Yes

Yes

Second command to be executed against each table/database.

@command3

nvarchar(2000)

Yes

Yes

Third command to be executed against each table/database.

@postcommand

nvarchar(2000)

Yes

Yes

This command is executed after any other commands and can be used for cleanup process after commands execution.

@replacechar

nchar(1)

Yes

Yes

Default value is “?” which represents the database/table name. You may need to change this value if you want “?” mark to be used in your query.

@whereand

nvarchar(2000)

Yes

No

With this you can specify the filtering criteria for your table collection. For details see the script section,

脚本1演示了sp_MSForEachTable的用法。第1条语句列出当前库所有的表和总的记录数,而语句2输出当前库下各表的空间占用情况。(注:在@cmd里用’’表示单引号,如select ‘’?’’)

Script #1 : sp_MSForEachTable system stored procedure

–List all the tables of current database and total no rows in it

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/409848
推荐阅读
相关标签
  

闽ICP备14008679号