`
zhangziyangup
  • 浏览: 1186419 次
文章分类
社区版块
存档分类
最新评论

小技巧 SQL execution loop

 
阅读更多

我们做测试的时候通常需要连续执行很多条相同的语句,我以前一直是通过While循环去做的,但是有一个更简单的办法,只需要用Go就可以实现了。

代码如下:

use DBA
go
create table test (name varchar(10)) on [group]
go
insert into test values ('allen')
go 1000

显示结果:

Beginning execution loop

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

(1 row(s) affected)

。。。。。。。。。

最后是1000行生效,证明数据已经被保存到表里了,方便吧。

分享到:
评论

相关推荐

    create detail report for SQL execution

    利用SQL monitor生成的运行报告,远远胜过 trace 10046,尤其在RAC的环境里, 方法如下: 1) run your SQL 2) get sql_id and sql_exec_id from gv$sql_monitor 3) create ...

    SQLServerExecutionTimes

    SQL Server Execution Times: CPU time = 0 ms, elapsed time = 0 ms. SQL Server Execution Times: CPU time = 0 ms, elapsed time = 0 ms. SQL Server Execution Times: CPU time = 0 ms, elapsed time = ...

    SQL Server Execution Plans Second Edition

    Execution plans show you what's going on behind the scenes in SQL Server. They can provide you with a wealth of information on how SQL Server is executing your queries, including the points below. • ...

    高清彩版 dissecting sqlserver execution plans

    标题:“高清彩版 dissecting sqlserver execution plans”(高清彩版剖析SQL Server执行计划),描述:“dissecting sqlserver execution plans”(剖析SQL Server执行计划),标签:oracle。这些信息表明,本文是...

    高清彩版 SQL Server Execution Plans Second Edition

    《高清彩版 SQL Server Execution Plans 第二版》是Grant Fritchey所著的一本专注于SQL Server查询执行计划的书籍。本书的前身于2008年出版,而第二版则在2012年推出了新的内容,以帮助读者深入理解SQL Server的内部...

    Pro Oracle SQL

    What you'll learn Master powerful SQL features implemented only in Oracle Database Read and interpret SQL execution plans Quickly diagnose and fix badly performing SQL Control execution plans through...

    [SQL工具] Red Gate SQL Toolbelt 2013.1.8.2.353

    Single-click script execution on multiple servers SQL Backup Pro Compress, securely encrypt and strengthen backups - fast SQL Monitor SQL Server performance monitoring and alerting SQL Comparison ...

    通过Mybatis拦截器自动定位慢SQL并记录日志

    if (executionTime > SLOW_SQL_THRESHOLD) { // 记录日志,包含SQL语句、执行时间等信息 logSlowSql(invocation, executionTime); } return result; } private void logSlowSql(Invocation invocation, ...

    显示 sql 执行效率.

    通过设置 Auto Trace,可以方便地获取 SQL 语句的执行计划(Execution Plan)和其他统计信息。 #### 设置 Auto Trace 设置 Auto Trace 可以通过以下命令实现: ```sql SET AUTOTRACE ON ``` 此命令开启后,执行...

    《Pro Oracle SQL》Chapter10 -- 10.2 Optimizing SQL -10.2.1Testing Execution Plans

    《Pro Oracle SQL》一书的第10章深入探讨了SQL优化,特别是10.2节,重点关注如何测试执行计划,这是SQL性能调优的关键环节。在这个部分,作者旨在帮助读者理解如何有效地评估和改进SQL查询的性能,以提高数据库系统...

    Sql效率查询

    ### SQL效率查询知识点 在SQL性能优化领域,查询效率至关重要,尤其当数据库承载大量业务时,高效率的SQL查询能够显著提升系统响应速度并降低服务器负载。本文将围绕标题“SQL效率查询”及其描述“直接运行函数,...

    MSSQL性能监控SQL语句

    Microsoft SQL Server(MSSQL)作为一款广泛使用的数据库管理系统,提供了丰富的工具和方法来监控其性能。本文将深入探讨MSSQL性能监控中的几个关键SQL语句,帮助数据库管理员(DBA)和开发者更好地理解和管理MSSQL...

    oracle执行动态sql

    WHILE (DBMS_SQL.FETCH_ROWS(l_sql_id) > 0) LOOP -- Loop through all columns FOR i IN 1..l_num_cols LOOP DBMS_SQL.COLUMN_VALUE(l_sql_id, i, l_column_value); -- Process l_column_value END LOOP; ...

    监控 SQL Server 的运行状况

    监控 SQL Server 的运行状况是确保数据库高效稳定运行的关键任务。SQL Server 提供了多种方法来监控和诊断系统性能,特别是通过动态管理视图 (DMV) 和动态管理函数 (DMF)。这些工具可以帮助管理员识别潜在的问题,如...

    DB2性能监控SQL

    SELECT num_executions, average_execution_time_s, prep_time_ms, prep_time_percent, SUBSTR(stmt_text, 1, 40) AS "SQL_Text" FROM sysibmadm.query_prep_cost WHERE average_execution_time_s > 0 ORDER BY prep...

    通过SQL 2005 系统表监控 SQL Server 的运行状况

    ### 通过SQL 2005系统表监控SQL Server的运行状况 在SQL Server 2005中,为了确保数据库系统的稳定性和高效性,管理员需要密切关注系统的运行状况,并及时发现潜在的问题。其中一种有效的方法就是利用SQL Server ...

    SQL Tuning.chm

    SQL Tuning author Dan Tow outlines a timesaving method he's developed for finding the optimum execution plan--rapidly and systematically--regardless of the complexity of the SQL or the database ...

    ORACLE并行SQL指南

    - **并行查询**:在并行查询中,一个复杂的SQL语句被分解成多个较小的子任务,这些子任务可以由不同的进程同时执行。例如,在进行大表扫描时,可以将表分成多个分区,每个分区由一个独立的进程处理。 - **并行DDL...

    DBA对Oracle SQL编写规范的总结

    这部分涵盖了更多高级的优化技巧,可以帮助开发人员进一步提高查询效率和代码质量。 ##### 4.1 多表关联编写顺序 - **规范要求**:当涉及到多表关联时,应当按照逻辑关系的紧密程度来组织表的顺序。 - **示例**: ...

Global site tag (gtag.js) - Google Analytics