解决方法
使用OPENROWSET:
INSERT MyTable (ImageColumnName) SELECT BulkColumn FROM OPENROWSET (BULK 'c:\myjpeg.jpg',SINGLE_BLOB) AS X
编辑哎呀,你使用2000 – 不支持以前的解决方案.你必须使用WRITETEXT:
CREATE TABLE MyTable ( ID INT PRIMARY KEY IDENTITY (1,1),ImageColumnName IMAGE NULL ) GO -- must insert a dummy value into the image column for TEXTPTR -- to work in next bit DECLARE @RowId INT INSERT MyTable (ImageColumnName) VALUES (0xFFFFFFFF) SELECT @RowId = SCOPE_IDENTITY() -- get a pointer value to the row+column you want to -- write the image to DECLARE @Pointer_Value varbinary(16) SELECT @Pointer_Value = TEXTPTR(ImageColumnName) FROM MyTable WHERE Id = @RowId -- write the image to the row+column pointer WRITETEXT MyTable.ImageColumnName @Pointer_Value 'c:\myjpeg.jpg'