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)
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.
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)
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.