Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.5k views
in Technique[技术] by (71.8m points)

sql server 2008 - Insert image into database

I'm trying to insert an image into the database.

CREATE TABLE ImageTable
(
    Id int,
    Name varchar(50) ,
    Photo varbinary(max) 
)

INSERT INTO ImageTable (Id, Name, Photo) 
SELECT 10, 'John', BulkColumn 
FROM Openrowset( Bulk 'C:caldophilus.jpg', Single_Blob) as EmployeePicture

It throws me an error.

Cannot bulk load. The file "C:caldophilus.jpg" does not exist.

Please Help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The file is probably on your client PC.
Don't forget that C: refers to the server C drive.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...