-1

我有以下视图运行到外部 mssql 数据库。我正在使用输入参数连接到相同的数据库以获得一些完整的存储过程,这些工作正常,但视图不起作用并给出错误

Warning: mssql_execute() [function.mssql-execute]: message: The request for procedure 'usv_Extended_Confirmation' failed because 'usv_Extended_Confirmation' is a view object. (severity 18) in 

Warning: mssql_execute() [function.mssql-execute]: General SQL Server error: Check messages from the SQL Server (severity 18) in 

Warning: mssql_execute() [function.mssql-execute]: stored procedure execution failed in

Warning: mssql_fetch_assoc() expects parameter 1 to be resource, boolean given in

调用视图的脚本如下

//run msdb connected view procedure
function runView($procedure){
    global $msdb;

    //initiate function
    $proc = mssql_init('usv_Extended_Confirmation', $msdb); 

    //Execute Procedure 
    $result = mssql_execute($proc); 

    while ($row = mssql_fetch_assoc($result)){
        $results[] = $row;    
        }
    $return = $results;

    //Free Memory 
    mssql_free_statement($proc); 

    return $return;
}
4

2 回答 2

2

您不执行视图。视图就像表或查询——你Select来自它。

$query = mssql_query('SELECT * FROM usv_Extended_Confirmation');
while ($row = mssql_fetch_assoc($query)) {
    ....
于 2012-08-07T14:51:25.117 回答
1

因为它是一个 VIEW 你不应该从 SELECT 语句中调用它

SELECT * FROM usv_Extended_Confirmation
于 2012-08-07T14:52:19.147 回答