You should be able to use the following syntax, assuming you are on a SQL 2008 server:
INSERT INTO StudentSkill (StudentID, SkillID) VALUES (100, 1), (100, 2), (100, 3)
This method is gleaned from here , which also contains several alternative methods.
You just need to iterate over the list of identifiers in FORM.skillid (assuming your form works) to create the SQL above. Also, make sure you use <CFQueryParam> for values โโwhen creating SQL. Something like the code below should do:
<cfif ListLen(FORM.skillid)> <cfquery> INSERT INTO StudentSkill (StudentID, SkillID) VALUES <cfloop list="#form.skillid#" index="skill"> (<cfqueryparam value="#form.studentID#" CFSQLType="CF_SQL_INTEGER">, <cfqueryparam value="#skill#" CFSQLType="CF_SQL_INTEGER">) </cfloop> </cfquery> </cfif>
source share