yitian8412 发表于 2007-12-13 21:42

求助

如何update mssql中的ntext类型的字段啊

madpbpl 发表于 2007-12-14 00:41

试试updatetext行不行

purana 发表于 2007-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

madpbpl 发表于 2007-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]]

purana 发表于 2007-12-14 15:14

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

madpbpl 发表于 2007-12-14 15:42

[quote]原帖由 [bold][underline]purana[/underline][/bold] 于 2007-12-14 15:14 发表 [url=http://bbs.bc-cn.net/redirect.php?goto=findpost&pid=1147604&ptid=192336][img]http://bbs.bc-cn.net/images/common/back.gif[/img][/url]
[em10]
不是一样吗?..
我写那个是WriteText就相当于Insert
你那个UpdateText就相当于Update操作..不是一样么? [/quote]
是这样,理解错了,谢谢指教。

happybaby40 发表于 2007-12-14 23:41

感觉好难啊...你们所回复的这些语句我都看不懂啊!!!!能解释一下吗?

页: [1]

编程论坛