If I had a nickel for every time someone gave me a list of identifiers and asked me to pull a result set for them I would be a very wealthy man. Over the years this is an endless request. I used to use several different tools like excel for example to convert the list of identifiers into SQL Statements. I would then use set based logic to complete my task inside SQL Server.
Being a SQL Server Database Administrator I like to use one consistent tool for working with queries. One day I noticed an interesting feature inside of the search and replace functionality inside Management Studio. I could utilize regular expression as a tool in my tool belt for manipulating text inside of SQL Server Management Studio. This gave me the functionality to stay within my preferred tool for doing SQL Server development work.
In order to use regular expressions with the find and replace tool expand the Find Options menu.
Once you click on this menu you will see that you can leverage regular expressions.
If you want to see how you can quickly manipulate the identifiers and convert them into table variable check out the video below.
Learn more about Rapid SQL, the intelligent IDE for SQL development, and try Rapid SQL for free.