In Sql Server, I use an XML type column to store the message. I do not want to keep duplicate messages.
I will only have a few posts for each user. I am currently querying a table for these posts, converting the XML into a string in my C # code. Then I compare the strings with what I'm going to insert.
Unfortunately, Sql Server pretty much prints data in XML-typed fields. What you store in the database does not necessarily match the same line as you later. This is functionally equivalent, but empty space can be removed, etc.
Is there an efficient way to compare the XML string that I consider when pasting with those that are already in the database? Aside, if I find a duplicate, I need to delete the old message, and then insert the replacement.
source
share