当使用默认图片创建新记录时,我想填充 SQL Server 数据库表的 varbinary(MAX) 列。如何使用触发器或在这种情况下通过任何其他方式执行此操作?
这是我尝试过的 T-SQL 代码:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[Trg_DoctorDemographic_DefaultImage]
ON [ECGManagementSystem].[dbo].[DoctorDemographic]
AFTER INSERT
NOT FOR REPLICATION
AS
BEGIN
INSERT INTO[ECGManagementSystem].[dbo].[DoctorDemographic]
(DPhoto)
SELECT * FROM OPENROWSET(Bulk N'D:\Programs\MSVC\Exercises\BEMS\BEMS\res\Doctor.bmp',SINGLE_BLOB)AS BLOB
END;