我有一个带有输出参数IDUtente的存储过程
ALTER PROCEDURE [dbo].[spGetIDUtente]
@IDUtente int OUTPUT,
@Cognome nvarchar(80),
@Nome nvarchar(50),
@NomeCompleto nvarchar(150),
@CF nvarchar(16)
AS
BEGIN
SET NOCOUNT ON;
SET @IDUtente = NULL
-- Recupero l'IDUtente tramite il suo codice fiscale [CF]
SELECT @IDUtente = IDUtente FROM dbo.Utenti WHERE CF = @CF我怎么才能和Laravel说呢?这是我的密码:
$id_utente = 0;
$id_utente = DB::select("call spGetIDUtente(?, ?, ?, ?, ?)", [
$id_utente,
$cognome,
$nome,
$nome_completo,
$cf
]);但它不起作用,我有个错误:
@P1附近语法错误
发布于 2017-03-27 19:10:53
我解决了自己的问题。这是使用Laravel在SQL SERVER中获取输出参数的方法:
$res = DB::select("
DECLARE @IDUtente int = 0
dbo].[spGetIDUtente]
@IDUtente = @IDUtente OUTPUT,
@Cognome = ?,
@Nome = ?,
@NomeCompleto = ?,
@CF = ?
SELECT @IDUtente as IDUtente", [$cognome, $nome, $nome_completo, $cf]);https://stackoverflow.com/questions/43030826
复制相似问题