0
通數據庫郵件參數存儲prcedure我想用數據庫郵件我的應用程序,這意味着我需要將參數傳遞到存儲過程sp_send_dbmail
只是出於測試目的,我有以下的代碼。然而,我想知道如何使用ssql server 2008和php將參數傳遞給存儲過程。 僅供參考我使用SQLSRV驅動程序從微軟使用PHP和SQL Server 2008
<?php require_once ('../Connection/connmail.php')?>
<?php
$sql = "{CALL sp_send_dbmail[[@profile_name='gmailsmtp']]}";//my stored procedure
$stmt = sqlsrv_query($conn,$sql)or die(print_r(sqlsrv_errors(),true));
?>
上面的代碼產生錯誤
Array ([0] => Array ([0] => 42000 [SQLSTATE] => 42000 [1] => 102 [code] => 102 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near '{'. [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near '{'.) [1] => Array ([0] => 42000 [SQLSTATE] => 42000 [1] => 105 [code] => 105 [2] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Unclosed quotation mark after the character string '[@profile_name='gmailsmtp']}'. [message] => [Microsoft][SQL Server Native Client 10.0][SQL Server]Unclosed quotation mark after the character string '[@profile_name='gmailsmtp']}'.))
任何幫助將不勝感激