Skip to content
Advertisement

REGEX in stored procedure in “=”/like clause

I’ve created a stored procedure with 3 inner joins (please, don’t judge me :D):

TableAnotherTable is the association table between Table and AnotherTable. So, this stored procedure works in some cases (if ET.Value is equal to A.Value).

But if:

the stored procedure must also work.

How can I change the last ON of the inner join clause (with “=”) to something like:

where pattern and pattern1 are ({.*?}) or (<.*?>)?

Thanks

Examples:

Advertisement

Answer

Unfortunately there is no regexp replace function in SQL Server. The closest you can get is by using PATINDEX to locate the <{ and }>' characters and STUFF` everything in between:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement