Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have managed to come up with an answer to my own question so thought I thought I would post here in case anyone else has similar requirements in the future. Basically it relies upon the SQL-CLR regular expression functionality and runs with minimal impact to performance.</p> <p>Firstly enable SQL-CLR on your server if not already available (you need to be sysadmin):</p> <pre><code>--Enables CLR Integration exec sp_configure 'clr enabled', 1 GO RECONFIGURE GO </code></pre> <p>Then you will need to create the assembly in SQL (Don't forget to change your path from <code>D:\SqlRegEx.dll</code> and use <code>SAFE</code> permission set as this is the most restrictive and safest set of permissions but won't go into detail here.) :</p> <pre><code>CREATE ASSEMBLY [SqlRegEx] FROM 'D:\SqlRegEx.dll' WITH PERMISSION_SET = SAFE </code></pre> <p>Now create the actual function you will call:</p> <pre><code>CREATE FUNCTION [dbo].[RegexMatch] (@Input NVARCHAR(MAX), @Pattern NVARCHAR(MAX), @IgnoreCase BIT) RETURNS BIT AS EXTERNAL NAME SqlRegEx.[SqlClrTools.SqlRegEx].RegExMatch </code></pre> <p>Finally and to complete and answer my own question we can then run the following TSQL:</p> <pre><code>SELECT * FROM your_table WHERE dbo.RegexMatch(@search, REPLACE(your_field, ' ', '.*?'), 1) = 1 SELECT * FROM your_table WHERE dbo.RegexMatch(@search, REPLACE(REVERSE(your_field), ' ', '.*?'), 1) = 1 </code></pre> <p>I hope this will help someone in what should be a simple search option in the future.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload