簡體   English   中英

在Nvarchar中搜索(最大值)

[英]Searching in Nvarchar(max)

我正在nvarchar(max)列中搜索以下字符串

<script src="http://d1.openx.org/ajs.php?zoneid=75288&amp;source

但是,當我使用CharIndex並嘗試查找時,我得到0

如何搜索該字符串? 我正在使用SQL 2008

這對我來說很好。 您確定參數順序正確嗎?

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

我要補充一點,如果這是數據庫清理,則可以使用REPLACE輕松更改周圍的內容。

您可能會檢查數據中是否沒有<而不是<

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM