jeudi 16 février 2017

Executing an SQL SERVER (MSSQL) Stored Procedure from laravel DB::select()

I have a problem related to this issue If I do:

 $st = \DB::select(
        "DECLARE @liResult INT, @lsMsg VARCHAR(200);
        EXEC ONW_SP_CANCELA_EMP '000016', @liResult, @lsMsg OUTPUT;
        SELECT @liResult as result, @lsMsg as msg;"
    );

    dd($st);

I get: []

But if I do this (comment out the exec to SP):

$st = \DB::select(
        "DECLARE @liResult INT, @lsMsg VARCHAR(200);
        -- EXEC ONW_SP_CANCELA_EMP '000016', @liResult, @lsMsg OUTPUT;
        SELECT @liResult as result, @lsMsg as msg;"
    );

    dd($st);

I get this: array:1 [▼ 0 => {#333 ▼ +"result": null +"msg": null } ]

An if I execute in the rdms console I do get the select correctly, do you know a work around for this?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lmeSeN
via IFTTT

Aucun commentaire:

Enregistrer un commentaire