请问如何在存储过程中将一个文件存储到image,ntext列中呢?
下面是一个拷贝图像到SQL Server的pubs数据库的例子, 表名pub_info, 字段名logo,图像文件名picture.bmp,保存到pub_id=0736记录
sp_textcopy @srvname = ServerName,
@login = Login,
@password = Password,
@dbname = pubs,
@tbname = pub_info,
@colname = logo,
@filename = c:\picture.bmp,
@whereclause = " WHERE pub_id=0736 ",
@direction = I
Examples
This example puts the text pointer into the local variable @ptrval, and then WRITETEXT places the new text string into the row pointed to by @ptrval.
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