注册 登录
编程论坛 SQL Server论坛

求助

yitian8412 发布于 2007-12-13 21:42, 1063 次点击
如何update mssql中的ntext类型的字段啊
6 回复
#2
madpbpl2007-12-14 00:41
试试updatetext行不行
#3
purana2007-12-14 09:54
使用
WriteText

下面是联机丛书的使用示例
USE pubs
GO
EXEC sp_dboption 'pubs', 'select into/bulkcopy', 'true'
GO
DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(pr_info)
FROM pub_info pr, publishers p
WHERE p.pub_id = pr.pub_id
   AND p.pub_name = 'New Moon Books'
WRITETEXT pub_info.pr_info @ptrval 'New Moon Books (NMB) has just released another top ten publication. With the latest publication this makes NMB the hottest new publisher of the year!'
GO
EXEC sp_dboption 'pubs', 'select into/bulkcopy', 'false'
GO
#4
madpbpl2007-12-14 13:23
看过一个例子用updatetext,不过针对的类型是text,难道updatetext只针对text,对ntext不支持?
例子如下
create table t(zsdwlist text)
insert t select N'adfasf'
DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(zsdwlist)
   FROM t
     
UPDATETEXT t.zsdwlist @ptrval 5 1 ':'


select * from t


drop table t

[[italic] 本帖最后由 madpbpl 于 2007-12-14 13:24 编辑 [/italic]]
#5
purana2007-12-14 15:14

不是一样吗?..
我写那个是WriteText就相当于Insert
你那个UpdateText就相当于Update操作..不是一样么?
#6
madpbpl2007-12-14 15:42
原帖由 [bold][underline]purana[/underline][/bold] 于 2007-12-14 15:14 发表 [url=http://bbs.bc-cn.net/redirect.php?goto=findpost&pid=1147604&ptid=192336][/url]

不是一样吗?..
我写那个是WriteText就相当于Insert
你那个UpdateText就相当于Update操作..不是一样么?

是这样,理解错了,谢谢指教。
#7
happybaby402007-12-14 23:41
感觉好难啊...你们所回复的这些语句我都看不懂啊!!!!能解释一下吗?
1