Let’s say I have a list of strings:
STRING1 STRING2 ... STRING200
And I want to create a query like:
SELECT count(*) FROM TABLE WHERE COLUMN IN ('STRING1', 'STRING2', ..., 'STRING200');
Quick solution using Notepad++:
- Open the file in Notepad++.
- In the Find what field, enter:
^(.*)$
- In the Replace with field, enter:
'$1',
- Set Search Mode to Regular expression.
- Click Replace All.
This will wrap each string in quotes and add a trailing comma, so you can paste it directly into your SQL
IN
clause.
Niciun comentariu:
Trimiteți un comentariu