Welcome to EMC Consulting Blogs Sign in | Join | Help

SSIS Junkie

T-SQL: Remove collation statements using Regular Expressions

I use datadude quite alot and recently I imported lots of tables into my datadude project but forget to configure it to not import the collation (more on how to configure that some other time). Hence, I had a huge collection of tables with unwanted collation statements in them.

An easy way to fix this is to use Visual Studio's find/replace functionality. That's OK, but my tables got imported with different collations (don't ask) so a standard find/replace wouldn't work. Thankfully Visual Studio supports regular expressions for finding "stuff". Here's the regular expression that I came up with for finding all my collation statements:

  • COLLATE[ ][a-zA-Z0-9_]*[ ]

Very simple. I'm mainly putting this here for my own benefit because I know I'll need it again someday. If it helps anyone else, so much the better.

 

-Jamie

 

 

Comments

No Comments
New Comments to this post are disabled

This Blog

Syndication

Powered by Community Server (Personal Edition), by Telligent Systems