Hi all, Has anyone ever tried looking for a UK Pound sign using the PATINDEX function? It's fine for other characters but fails to find
The following code returns -1 because the function does not locate the pound symbol (it is in there!)
SELECT @.intPos = PATINDEX('%%', [my_text_field]) FROM my_table
Any suggestions?
Many thanks!I just tried a little test...
declare @.v1 varchar(10), @.v2 nvarchar(20)
select @.v1 = '100.00', @.v2 = '100.00'
select @.v1, @.v2
select PATINDEX('%%', @.v1),PATINDEX('%%', @.v2)
and got
---- -------
100.00 100.00
---- ----
1 1
do you have anymore details?|||Ah, yes your test certainly works! Your test spurred me to rey something out...Indeed I've found out why my code was not working...
It turned out that the data I was accessing contained a unc pound character amongst the text, this looked correct in my WinXP Notepad but manifested as two odd characters when viewed in sql server, that's why my search for a normal pond character was failing!
Thanks for you help!|||sometimes it's hard to see the forrest because of all the trees! Gald to help!
No comments:
Post a Comment