String comparison in SQL Server
I have 2 strings in a SQL Server 2008 stored proc.
First string is, '2 piece Leather Sofa Sofa'
Second string is '3 pc Sofa'.
If any substrin开发者_StackOverflow中文版g in the second string is present in the first string more than once I need to remove those occurrences from the first string.
For example, in the second string I have Sofa and in the first string I have Sofa twice, I need to remove from the first string any repeated occurrences of word Sofa. How should I do that. I help would be deeply appreciated.
Thanks.
SQL Server and T-SQL doesn't excel at string manipulations like this. The T-SQL string stuff is quite basic - grab a substring, search for a character and that's about it.
This task is more of a .NET domain.
Can you create a SQL-CLR assembly to handle this and deploy it into SQL Server? That would be by far the easiest way to go...
精彩评论