Monday, March 19, 2012

compare text fields

Hi all,
What is the fastest and best way to compare two text fields. I just need
to know when the values are different. Are there any functions available to
do this? Please provide any code if you have it or any links regarding this
problem.
Thanks in advance...What about;
Select Case textfiled1 When textfield2 THEN 'The same" ELSE 'Not Eqal' END
From Sometable
Or you could perform a self outer join.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"sql" <donotspam@.nospaml.com> schrieb im Newsbeitrag
news:eBA3P0jVFHA.3188@.TK2MSFTNGP09.phx.gbl...
> Hi all,
> What is the fastest and best way to compare two text fields. I just need
> to know when the values are different. Are there any functions available
> to do this? Please provide any code if you have it or any links regarding
> this problem.
> Thanks in advance...
>|||Thanks. But I thought you can't use text data types in the CASE statements!
"Jens Smeyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote in
message news:ujgKH6jVFHA.4056@.TK2MSFTNGP15.phx.gbl...
> What about;
> Select Case textfiled1 When textfield2 THEN 'The same" ELSE 'Not Eqal'
END
> From Sometable
> Or you could perform a self outer join.
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
> "sql" <donotspam@.nospaml.com> schrieb im Newsbeitrag
> news:eBA3P0jVFHA.3188@.TK2MSFTNGP09.phx.gbl...
need
regarding
>|||You can use the [NOT] LIKE operator.
For example,
SELECT * FROM Table1 t1 JOIN Table2 t2 ON t1.SomeID = t2.SomeID
WHERE t1.SomeTextField NOT LIKE t2.SomeTextField
"Nikhil Patel" wrote:

> Thanks. But I thought you can't use text data types in the CASE statements
!
> "Jens Sü?meyer" <Jens@.Remove_this_For_Contacting.sqlserver2005.de> wrote
in
> message news:ujgKH6jVFHA.4056@.TK2MSFTNGP15.phx.gbl...
> END
> need
> regarding
>
>|||Hi Edmire,
Thanks. But this only works if the length of the value stored in text
field is <= 8000 characters long. If the length exceeds 8000 characters, it
does not work.
"Edmire" <Edmire@.discussions.microsoft.com> wrote in message
news:FE8C9CF7-E03E-415A-85E1-1FA1252DFA17@.microsoft.com...
> You can use the [NOT] LIKE operator.
> For example,
> SELECT * FROM Table1 t1 JOIN Table2 t2 ON t1.SomeID = t2.SomeID
> WHERE t1.SomeTextField NOT LIKE t2.SomeTextField
>
> "Nikhil Patel" wrote:
>|||Try spinning through them with READTEXT. I think that's the only option.
"sql" wrote:

> Hi Edmire,
> Thanks. But this only works if the length of the value stored in text
> field is <= 8000 characters long. If the length exceeds 8000 characters, i
t
> does not work.
> "Edmire" <Edmire@.discussions.microsoft.com> wrote in message
> news:FE8C9CF7-E03E-415A-85E1-1FA1252DFA17@.microsoft.com...
>
>

No comments:

Post a Comment