首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更新NText列

更新NText列
EN

Stack Overflow用户
提问于 2009-09-29 09:40:49
回答 1查看 12.7K关注 0票数 0

在我的NText专栏中,我在<script type='text/javascript'> </script>标记之间有一些数据。

我希望用以下数据替换<script type='text/javascript'> </script>标记之间的所有数据:

代码语言:javascript
复制
<!--//<![CDATA[
   var m3_u = (location.protocol=='https:'?'https://d1.openx.org/ajs.php':'http://d1.openx.org/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=946288&amp;source=_self&amp;target=_top&amp;block=1&amp;blockcampaign=1");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
//]]>-->

我该怎么做呢。请分享解决方案。

更新:这里是字符串

代码语言:javascript
复制
<script src="http://d1.openx.org/ajs.php?zoneid=34288&amp;source=_self&amp;target=_top&amp;block=1&amp;blockcampaign=1&amp;cb=98346855009&amp;charset=unicode&amp;loc=http%3A//www.mysite.com/Admin/AddEditArticle.aspx%3FID%3D623" type="text/javascript"></script>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2009-09-29 10:28:06

您使用的是什么版本的Server??

如果您在2005年或以上,请尽量避免使用NTEXT,而使用NVARCHAR(MAX)代替- NVARCHAR(MAX)支持所有常见的字符串操作,而NTEXT不支持.

另外,NTEXT/TEXT/IMAGE被废弃,并将从未来的Server版本中删除--因此,如果可以的话,立即升级!:-)

更新:好的,所以您不能更改数据类型。您现在使用的是Server的版本吗??2000? 2005?

在2005年及以上,您可能会做这样的事情:

代码语言:javascript
复制
DECLARE @YourOriginalText NVARCHAR(MAX)

SELECT @YourOriginalText = CAST(YourNTextColum AS NVARCHAR(MAX))
FROM dbo.YourTable
WHERE id = .......

// modify the NVARCHAR(MAX) variable
DECLARE @YourModifiedText NVARCHAR(MAX)

SET @YourModifiedText = REPLACE(@YourOriginalText, '....', '......')

// update the table after modification
UPDATE dbo.YourTable
SET ntextColumn = CAST(@YourModifiedText AS NTEXT)
WHERE id = ........

Marc

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1491554

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档