I am searching for the following string in a nvarchar(max) column
<script src="http://d1.openx.org/ajs.php?zoneid=75288&amp;source
However when I use CharIndex and try to find, I get 0
How can I search for that string? I am using SQL 2008
I am searching for the following string in a nvarchar(max) column
<script src="http://d1.openx.org/ajs.php?zoneid=75288&amp;source
However when I use CharIndex and try to find, I get 0
How can I search for that string? I am using SQL 2008
This works fine for me. Are you sure you have the parameters in the right order?
create table #t
(test nvarchar(max))
insert #t
select 'abcdefghijklmnop<script src="http://d1.openx.org/ajs.php?zoneid=75288&amp;source12345'
select charindex('<script src="http://d1.openx.org/ajs.php?zoneid=75288&amp;source',test,0)
from #t
I would add that if this is database cleanup, you can use REPLACE to change things around easily.
you might check that your data doesn't have an < instead of <