Search code examples
sqlwpfrichtextboxflowdocument

Search for only user specified text stored as flowdocument in sql table


I am currently saving information from a rich text box as flowdocument to my sql table which has a column defined as nvarchar(MAX). The data is stored as follows:

<FlowDocument PagePadding="5,0,5,0" AllowDrop="True" NumberSubstitution.CultureSource="User" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"><Paragraph>Messages at admin Level.Modified</Paragraph></FlowDocument>

The problem is when i search this column with a keyword "user", i want it to return records which has "user" in the paragraph and not in the Flowdocument definition. How can i modify my search to reflect the user input text?


Solution

  • Where (col like '% user%' or col like '%user %") and col not like '%NumberSubstitution.CultureSource="User"'

    Or

    where CHARINDEX ( 'user', col , CHARINDEX('com/winfx/2006/xaml/presentation">', col) ) > 0