How to replace ENTER with comma in MS Word
I want to share with you very useful tip I got from my college.
There are cases when you need to generate a comma separated
string for 'IN' clause in a Select statement. For example:
SELECT *
FROM SomeTable
WHERE SomeColumn IN (xxx,yyyy,www,zzzz)
Let`s assume that you have some values separated by Enter,
like this:
42344
32432
54435
45345
43534
45243
This also can be the result of copying some column values
from a select in the SSMS:
Ok, suppose you copied these values and pasted them in MS Word
document. The quickest way to replace the Enters with commas
is to use Find and Replace option (Ctrl-H)
There are cases when you need to generate a comma separated
string for 'IN' clause in a Select statement. For example:
SELECT *
FROM SomeTable
WHERE SomeColumn IN (xxx,yyyy,www,zzzz)
Let`s assume that you have some values separated by Enter,
like this:
42344
32432
54435
45345
43534
45243
This also can be the result of copying some column values
from a select in the SSMS:
Ok, suppose you copied these values and pasted them in MS Word
document. The quickest way to replace the Enters with commas
is to use Find and Replace option (Ctrl-H)
href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJq6jUkvy-Ci-SbihzQU5vuMjdGYwG8OhXAqE0eCTzr-f4B1_je57g-IXfJgxhy3iy0dbUb00J3rJ8-gEPYEH1IMN4D7nMGHyVU1BgYKR3uJyijiFM-QJPuoZt5c6Q1hyJdhJD3ElO5Ag/s1600/WordSample.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;">
Press Ctrl-H and enter the following:
Now click on "Replace All" button:
Here are some more useful codes you can use:
TAB CHARACTER
Type ^t or type ^9
ANY DIGIT
Type ^#
ANY LETTER
Type ^$
I think it is not possible , because the "Replace" dialog box
in Notepad does not work with non-printing characters.
Press Ctrl-H and enter the following:
Now click on "Replace All" button:
Here are some more useful codes you can use:
TAB CHARACTER
Type ^t or type ^9
ANY DIGIT
Type ^#
ANY LETTER
Type ^$
You can see more codes here
Note: All this above can be also done in SSMS by using Regular Expressions:
See my post about it.
Note: All this above can be also done in SSMS by using Regular Expressions:
See my post about it.
P.S: do you know the way how to do this in Notepad?
I think it is not possible , because the "Replace" dialog box
in Notepad does not work with non-printing characters.
I will be glad to know if I am wrong.