2

I need to call stored procedure on SQL server and pass array of items. Example passing student info with multiple awards:

[awards]
id, description
1, Award 1
2, Award 2
3, Award 3
4, Award 4
5, Award 5

students:
id, first_name, last_name 

I need to pass one student with multiple award ID's (this number can vary). The end result wold be as follow:

[students]
17, John, Doe [INSERTED]  

[student_awards]
id, student_id, award_id
1, 17, 2 [INSERTED]
1, 17, 3 [INSERTED]
1, 17, 5 [INSERTED]

I am not asking for stored procedure - I can write it myself. I am asking help in understanding of a way to pass array with multiple award_id's.

Thank you!

4
  • what you have tried?? Commented Feb 9, 2017 at 10:11
  • 1
    You might want to look at this so post Commented Feb 9, 2017 at 10:13
  • Nothing so far. But I think that my question is clear ... Cannot find an answer: is it possible to pass an array as a single argument to stored procedure from php to SQL server? Above is just an example... Commented Feb 9, 2017 at 10:13
  • Actually, according to the link in the answer I've linked in, a UDT data type is mapped to PHP's Stream2 data type. I know nothing about PHP so I don't know if it helps you. Commented Feb 9, 2017 at 10:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.