Wednesday 17 October 2012

Comma seperated values for sql in statement with notepad ++

We've all done it,

we need a select statement of strings from a select in a sql table.  I recently did this wanting a list of codes so a quick select statement gave us this :

code1
code2
....
code2000

and i needed an in statement in sql so needed to have it :

'code1','code2',...'code2000'

quick tip, open notepad ++


Notice i selected extended, and do a replace for \r\n replace with ',' and shazam ! we have a comma seperated list, just add the first quote and the last one.

great quick tip.

No comments:

Post a Comment