Best Steps for replacing in sql files
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.
精彩评论