Gladimir
Well-known member
Here is my current SQL statement that produces a syntax error:
I came across one of those SQL Tutorial sites that said something like this would be legal, but I had my doubts from the beginning.
What I am trying to do is INSERT INTO myTable (DescID) VALUES(intDescID) WHERE (Description=strDescription)". I just dont know the proper syntax or even if it is possible to do with a single SQL statement.
Background
I select distinct descriptions and come up with about 4000 rows. For each of those distinct descriptions, I am trying to use my INSERT statement to update records in another table. Sometimes Description equals strDescription in only one row, and other times that criteria will return just under 10,000 rows or matches.
C#:
"INSERT INTO " + strTableName + " (DescID) " +
"SELECT DescID FROM " + strTableName + " WHERE (Description=" + strDescription + ") " +
"VALUES(" + intDescID.ToString() + ")";
I came across one of those SQL Tutorial sites that said something like this would be legal, but I had my doubts from the beginning.
What I am trying to do is INSERT INTO myTable (DescID) VALUES(intDescID) WHERE (Description=strDescription)". I just dont know the proper syntax or even if it is possible to do with a single SQL statement.
Background
I select distinct descriptions and come up with about 4000 rows. For each of those distinct descriptions, I am trying to use my INSERT statement to update records in another table. Sometimes Description equals strDescription in only one row, and other times that criteria will return just under 10,000 rows or matches.