M
middletree
I know this is a SQL101 question, but darned if my fried brain can figure it
out right now.
I want to insert rows into a table which only has 2 fields. It comes from an
ASP multiple select form element; users can choose to select more than one
selection. If they only select one, it works fine, because it produces this
SQL statement:
INSERT INTO TKT_ASSIST (TicketID, EmployeeID) VALUES ('15167','200')
But if they select more than one, the value of the form is a comma-delimited
value, for example 200,300, which then yields:
INSERT INTO TKT_ASSIST (TicketID, EmployeeID) VALUES ('15167','200, 331')
As you can imagine, I get a SQL error:
Syntax error converting the varchar value '200, 331' to a column of data
type int.
So I should do some ASP script which will do a split of the values and
insert them one at a time. But I have to ask first, is there a SQL way to
insert these, so that one row will be inserted for each value given for the
EmployeeID?
out right now.
I want to insert rows into a table which only has 2 fields. It comes from an
ASP multiple select form element; users can choose to select more than one
selection. If they only select one, it works fine, because it produces this
SQL statement:
INSERT INTO TKT_ASSIST (TicketID, EmployeeID) VALUES ('15167','200')
But if they select more than one, the value of the form is a comma-delimited
value, for example 200,300, which then yields:
INSERT INTO TKT_ASSIST (TicketID, EmployeeID) VALUES ('15167','200, 331')
As you can imagine, I get a SQL error:
Syntax error converting the varchar value '200, 331' to a column of data
type int.
So I should do some ASP script which will do a split of the values and
insert them one at a time. But I have to ask first, is there a SQL way to
insert these, so that one row will be inserted for each value given for the
EmployeeID?