开发者

Best Steps for replacing in sql files

开发者 https://www.devze.com 2023-01-27 04:05 出处:网络
I need t开发者_StackOverflow中文版o update all varchar to nvarchar, text to ntext and char to nchar in some 300 .sql files stored on my disk. These files include stored procedures, triggers, functions

I need t开发者_StackOverflow中文版o update all varchar to nvarchar, text to ntext and char to nchar in some 300 .sql files stored on my disk. These files include stored procedures, triggers, functions, views etc. What is the best approach to achieve this.


If you really want the safe way, you'd need to use a parser which actually understands the structure and only replaces these occurenses which do match.

I'm not sure if the effort to dive into it is worth it, but you could code something yourself. You could try and see if an opensource T-SQL parser can handle your files; one is part of the opensource bsn ModuleStore versioning toolset.


.sql files are nothing more than text files anyhow. I would iterate through the files and replace these string while parsing.

0

精彩评论

暂无评论...
验证码 换一张
取 消