0

在 ColdFusion 中,我使用 3 个输入和 6 个输出调用了以下 cfstoredproc。

<cfstoredproc procedure="si_updateProject" datasource="#mydsn#" returncode="yes">
    <cfprocparam type="IN" cfsqltype="CF_SQL_VARCHAR" value="#platform#">
    <cfprocparam type="IN" cfsqltype="CF_SQL_VARCHAR" value="#projectData#">
    <cfprocparam type="IN" cfsqltype="CF_SQL_VARCHAR" value="#sysData#">
    <cfprocresult name="projectInfo" resultSet=1>
    <cfprocresult name="newPSA" resultSet=2>
    <cfprocresult name="newStatus" resultSet=3>
    <cfprocresult name="goliveSystems" resultSet=4>
    <cfprocresult name="goliveHistory" resultSet=5>
    <cfprocresult name="newSystems" resultSet=6>
</cfstoredproc>

在存储过程中si_updateProject,如何识别为结果集列出的 6 个结果集查询?存储过程有几个语句(选择、更新、删除等)。

4

1 回答 1

1

(以上评论的概要..)

SELECT除了查看生成结果的语句的 sql 并比较columnList值 之外,我不知道有任何方法。

当我需要测试对涉及虚拟表的存储过程的修改时,我通常只是注释掉CREATE PROCEDURE ... BEGINandEND语句并在查询分析器中手动运行 sql。技术含量很低,但对快速测试很有用。

--- Comment out the procedure wrapper and run the sql in
--- the query analyzer manually with test parameters
DECLARE @platform varchar(50)
DECLARE @projectData varchar(50)
DECLARE @sysData varchar(50)

SET @platform = 'foo'
SET @projectData = 'bar'
SET @sysData = 'qax'

/*     
CREATE PROCEDURE si_updateProject
        @platform varchar(50)
        , @projectData varchar(50)
        , @sysData varchar(50)
AS
BEGIN
*/

        -- simulate some virtual tables
        DECLARE @table1 TABLE ( columnOne varchar(50), createdDate datetime)
        DECLARE @table2 TABLE ( columnTwo varchar(50), createdDate datetime)
        DECLARE @table3 TABLE ( columnThree varchar(50), createdDate datetime)

        -- now you can do whatever debugging you want with the virtual tables ...
        SELECT  'Testing the 1st resultset' AS DebugText, *
        FROM    @table1


        -- simulate some resultsets
        SELECT  columnOne FROM @Table1
        SELECT  columnTwo FROM @Table2
        SELECT  columnThree FROM @Table3

/*
END */
GO
于 2012-02-13T22:18:57.833 回答