易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL存储过程测试(4)——创建T

问题
      如何创建一个T-SQL测试套件用于测试SQL存储过程。
设计
      首无,通过插入大量测试平台数据准备好一个包含待测存储过程的底层数据库。接下来,使用一个SQL游标(cursor)遍历这个测试用例数据表。针对每个测试用例,调用待测存储过程并且取得它的返回值,把实际返回值与期望值进行比较,从而判定测试结果是通过与否,然后显示或保存测试结果。
方案
——testAuto.sql
——为dbEmployees填充数据
truncate table dbEmployees.dbo.tblEmployees
insert into dbEmployees.dbo.tblEmployees values('e11','Adams','15/10/2009')
insert into dbEmployees.dbo.tblEmployees values('e22','Baker','15/10/2009')
insert into dbEmployees.dbo.tblEmployees values('e33','Young','15/10/2009')
insert into dbEmployees.dbo.tblEmployees values('e44','Zetta','15/10/2009')
——此处插入更多数据
declare tCursor cursor fast_forward
    for select caseID,input,expected
    from dbTestCasesAndResults.dbo.tblTestCases
    order by caseID
declare @caseID char(4),@input char(3),@expected int
declare @actual int,@whenRun datetime
declare @resultLine varchar(50)
set @whenRun = getdate()
open tCursor
fetch next
    from tCursor
    into @caseID,@input,@expected
while @@fetch_status = 0
    begin
    exec @actual = dbEmployees.dbo.usp_StatusCode @input
    if (@actual = @expected)
        begin
            set @resultLine = @caseID + ': Pass'
            print @resultLine
        end
    else
        begin
            set @resultLine = @caseID + ': FAIL'
          &nbs


相关文档:

SQL触发器实例讲解

SQL触发器实例1
定义: 何为触发器?在SQL Server里面也就是对某一个表的一定的操作,触发某种条件,从而执行的一段程序。触发器是一个特殊的存储过程。
      常见的触发器有三种:分别应用于Insert , Update , Delete 事件。
      我为什么要使用触发器?比如, ......

Sql 点滴

ID int identity(1,1) primary key 自动增长,主键
EXEC sp_rename 'login_info','PDI_login_info'  执行存储过程 sp_rename , 将login_info表名 更改为 PDI_login_info
SET   XACT_ABORT  {ON|OFF} 如果事务中发生错误,on   则会终止整个事务的执行,如果OFF,继续错误的下面一句  
SET &nbs ......

JSP实例三、sql分页(1)

index.jsp
<%@ page language="java" import="java.sql.*" import="java.lang.*" import="java.util.*" pageEncoding="GB2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%!
& ......

SQL2005和(Excel |access)之间的数据导入导出


Sql代码
--采用SQL语句实现sql2005和Excel 数据之间的数据导入导出,在网上找来一--下,实现方法是这样的:    
  
  
--Excel---->SQL2005  导入:    
  
  
select * into useinfo from O ......

SQL Server企业版/标准版/个人版的区别

 SQL Server企业版/标准版/个人版的区别
http://blog.163.com/meteor_zc/blog/static/33150220200811291738603/
SQL Server企业版/标准版/个人版的区别?--西部E网weste.net 2008-12-29 01:07
分类:默认分类 字号: 大大  中中  小小 SQL Server企业版/标准版/个人版的区别?
  对于新接触SQL数据库 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号