-1

I have one sp for inserting the data, it has three params, Ex: a,b,c. so I want to run the sp with params, but not able to find the solution in laravel.

This is what i tried.

DB::select('EXEC sp_name @a=a, @b=b, @c=c');

But, its not working.

Vikash
  • 3,391
  • 2
  • 23
  • 39

2 Answers2

0

I have got the answer. only quote was missing

This is the working example

DB::select("EXEC sp_name @a='a', @b='b', @c='c'");
Vikash
  • 3,391
  • 2
  • 23
  • 39
-1

Try this:

$a=1;
$b=2;
$c=3;
$data=DB::select('call sp_name(?,?,?)',[$a,$b,$c]);
Tohid Dadashnezhad
  • 1,808
  • 1
  • 17
  • 27
  • Please read my question, i have asked about named parameters, in your answer. i have to keep the order, which i don't want – Vikash Apr 14 '18 at 08:02
  • Sorry, But you have not mentioned anything about the order of the parameters. You just asked how to call sp with parameters this is what exactly you asked "I want to run the sp with params". If you don't ask question clearly you won't see right answer! – Tohid Dadashnezhad Apr 14 '18 at 08:08