数据库表对于字段IMAGE数据类型如何进行插入或者更新。
对于插入比较简单可以用INSERT语句
CREATE PROCEDURE uf_chw_cpflInfoInsert
-- Add the parameters for the stored procedure here
@flLevel as MyVarchar50,
@lbMc as MyVarchar50,
@lbXh as MyVarchar50,
@flZjm as MyVarchar50,
@lbTx as MyImage
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO [chw_cpflInfo]
([flLevel]
,[lbMc]
,[lbXh]
,[flZjm]
,[lbTx])
VALUES
(@flLevel,@lbMc,@lbXh,@flZjm,@lbTx)
END
更新:
CREATE PROCEDURE uf_chw_cpflInfoUpdate
-- Add the parameters for the stored procedure here
@lbBh as MyIdentity,
@flLevel as MyVarchar50,
@lbMc as MyVarchar50,
@lbXh as MyInt,
@flzjm as MyVarchar50,
@lbTx as MyImage
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
update chw_cpflinfo
set fllevel=@fllevel,
lbmc=@lbMc,
lbXh=@lbXh,
flzjm=@flZjm,
lbTx=@lbTx
where lbbh=@lbbh
EXEC sp_dboption 'chemicalweb', 'select into/bulkcopy', 'true'
-- 当为 true 时,允许使用 SELECT INTO 语句和快速大容量复制。
DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(lbtx) from chw_cpflinfo where lbbh=@lbbh
--UPDATETEXT chw_cpflinfo.lbtx @ptrval null null @lbTx
WRITETEXT chw_cpflinfo.lbtx @ptrval @lbTx
EXEC sp_dboption 'chemicalweb', 'select into/bulkcopy', 'false'
END
本文介绍了一个具体的存储过程,用于向数据库表中插入和更新带有IMAGE数据类型的字段。具体包括创建存储过程以执行插入和更新操作的方法,以及如何通过TEXT指针来更新文本数据。
853

被折叠的 条评论
为什么被折叠?



