Hi,I'm faced with the task of creating a script that will do a series of inserts. The insert statements will look the same except for one value, which will differ for each insert. For simplicity's sake, here is a table with some inserts:CREATE TABLE #MyTable ( MyPk INT IDENTITY, MyValue VARCHAR(24) )INSERT INTO #MyTable (MyValue) VALUES ('Whatever')INSERT INTO #MyTable (MyValue) VALUES ('Something')INSERT INTO #MyTable (MyValue) VALUES ('Filler')INSERT INTO #MyTable (MyValue) VALUES ('Who Cares')SELECT * FROM #MyTableDROP TABLE #MyTable
Rather than having to modify the string for each individual update statement, I'm hoping there is a simple way to create a variable (perhaps an array) which holds an indefinite number of values, then have a loop which automatically does an insert for each specified value in the array. Is something like this possible? Or is there a preferred industry standard for this sort of thing that I should use instead?Thanks!