打开 notepad++,

将从sql server中查到的某列数据 copy到 notepad++,

如图所示:

  

notepad++ 批量替换技巧_3d


开始操作,

1) ctrl + F

   search:  ^

   replace what: ,'

   wrap around: checked

  search mode: Regular expression

  click button: replace all


   如图:

   

notepad++ 批量替换技巧_notepad++_02


2)

    search: \r\n

    replace with: '\r\n

   wrap around: checked

  search mode: extended (\n, \r, \t, \0, \x.... )

  click button: replace all

    如图:

       

notepad++ 批量替换技巧_notepad++_03


3), 首尾的数据行稍微处理一下,

    copy到你要的地方,即可。


     eg:   

SELECT [Key], [Name] as CityName
FROM KBSERVICE.DBO.GEOGRAPHYTIER_New A
WHERE [Key]
IN
(
'3EAA64A5-3701-4E6A-87C3-2AC3A7613458'
,'784FCC9D-F967-4230-9B5B-1713A0E5F94F'
,'9DBD3BEE-EFDB-4124-A7D9-A0D24596B40E'
,'FB6BC3A9-5863-4E52-944F-62E7E5AD550D'
,'3B695D94-B7CC-4E12-9212-4B3F8B382AB7'
,'9DBD3BEE-EFDB-4124-A7D9-A0D24596B40E'
,'3B695D94-B7CC-4E12-9212-4B3F8B382AB7'
,'C57B190F-5EB7-4546-923C-469C6A8B1BA0'
,'DBD83D1A-57E5-468C-A8A3-822A48EF49F9'
,'3ED5AF3F-0DCF-4D98-BFA7-754BC18FD78E'
,'757D51EE-130B-43E6-B0B7-73E3B18823FB'
,'F047191F-188D-47FF-B125-D5CDF01621ED'
,'85FDCC91-A1E9-4EC8-9CE4-3391357CB3DC'
------
)



       


(结束)