I need help. I want to extract multiple parts of sql statement string. ex. I have the example of string:
UPDATE table SET **XXX** = '1', **YYY** = 2 WHERE ID = 24125;
So, I want to extract these values in bold ('xxx' and 'yyy'. In general, names of columns changed via Update statement.
Here is the example using the substring function, for selecting only one part, but in my case I need multiple parts:
statement like '%UPDATE%' then SUBSTRING(statement,NULLIF(CHARINDEX('SET',statement),0)+LEN('SET')+1, NULLIF(CHARINDEX('=',statement),0) -(NULLIF(CHARINDEX('SET',statement),0)+LEN('SET')+1))
Thank you!