Skip to content
Advertisement

Express passing arrays into sql (express/mssql/react)

I am trying to upload two arrays into my sql database. This is what I have come up with.(this is my server.js using a endpoint from my client side)

My express

My sql stored procedrue

However this throws

I believe this is because

need to be unique and as they are in a for loop they are repeated within the statement. Is there a way in which I can make this a valid transaction with the database and so that these are unique.

Thankyou for your time 🙂

Advertisement

Answer

I solved this issue by putting

within the for loop.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement