I have a list like this thing1,thing2,thing3. And I want to insert them into a look-up table with the same foreign key. So ideally it would look like this:
I was getting a database error with
INSERT INTO lkp_things (foreign_key,thing)
VALUES (1,'thing1'),(1,'thing2')
Leigh helped me realize that I was actually using SQL Server '00, and that version does not allow this method of insertion. So, I had to use this:
INSERT INTO lkp_things (foreign_key,thing)
SELECT 1,'thing1'
UNION ALL
SELECT 1,'thing2'
In CF that looks like this:
INSERT INTO lkp_Things (id,thing)
SELECT ,
UNION ALL
I found this solution here: How do I insert multiple rows WITHOUT repeating the "INSERT INTO dbo.Blah" part of the statement?