What is this little snippet:
... p7,ex8,p8,,p3,p4,p5 ...
^^
meant to be?
That’s a rhetorical question by the way, since at least one commenter didn’t understand that 🙂 That’s where your trouble lies.
In fact, since you have 24 column names (excluding the empty one between the commas) and only 18 values to be inserted (and also based on the column/value names), it’s a near-certainty that the entire section from that second comma onwards is superfluous. Try removing the entire ,,p3,p4,p5,p6,p7,p8
and using this:
insert into ExpTab (
username, month, ex1, p1, ex2, p2, ex3, p3,
ex4, p4, ex5, p5, ex6, p6, ex7, p7, ex8, p8
) values (
@name, @month1, @ex1s, @p1s, @ex2s, @p2s, @ex3s, @p3s,
@ex4s, @p4s, @ex5s, @p5s, @ex6s, @p6s, @ex7s, @p7s, @ex8s, @p8s)
That should fix your problem.
3
solved Incorrect syntax near ‘,’ [closed]