Skip to content
Advertisement

is there any way to insert an array values into INT datatype in SQL?

I am trying to insert into a table called Observations, I need to insert 10 rows using for loop, I have an array of 10 values that need to be inserted in a column called sens_value which is an INT type. I have tried the following code but it cant take sensValues[i] as an INT.

I am using noodjs to insert into tables using mariadb database.

Basically I am looking for a way to insert different INT values into my SQL statement using for loop. I tried the following code:

Advertisement

Answer

The sensValues[i] in the VALUES is treated as a string, not as a value from the array. Pass it on as a parameter:

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