I know this is a Database Forum, but since the text I am trying to find is SQL-specific, I am hoping that somebody can point me in the right direction. I need to search code to find places where the INSERT queries are written without explicitly specifying table column names. For example, I need to find things like this:
INSERT tablename SELECT col1, col2 FROM anothertable INSERT INTO tablename VALUES (1), (2)
In case you wonder, when the column names are not explicitly specified after the table name, the SQL Server will implicitely assume that all of the columns are listed. As a result, if you add a new column to the table, your code will break.
The regex pattern I envision would look for the following:
INSERT followed by any characters, followed by either
VALUES where there is no occurrence of closing parenthesis ")" before the
I was thinking about alternative way to phrase it, but I am not sure it's easier:
INSERT INT followed by space/tab/cr/lf, followed by any number of characters, followed by space/tab/cr/lf, NOT followed by open parenthesis "("
I appreciate any pointers.