仅使用 SQL 将图片插入 SQL Server 2005 图像字段

2021-12-07 00:00:00 image sql sql-server-2005 sql-server

使用 SQL Server 2005 和 Management Studio 如何将图片插入表的 Image 类型列?

Using SQL Server 2005 and Management Studio how do I insert a picture into an Image type column of a table?

最重要的是我如何验证它是否存在?

Most importantly how do I verify if it is there?

推荐答案

CREATE TABLE Employees
(
    Id int,
    Name varchar(50) not null,
    Photo varbinary(max) not null
)


INSERT INTO Employees (Id, Name, Photo) 
SELECT 10, 'John', BulkColumn 
FROM Openrowset( Bulk 'C:photo.bmp', Single_Blob) as EmployeePicture

相关文章