[sql]將圖檔新增到資料庫中

  • 656
  • 0
  • 2019-04-19

[sql]將圖檔新增到資料庫中

INSERT INTO One_HitDetail (T_SN, FaceType, QueryObject, MemberObject, Time)
VALUES
('rfv123',
 1, 
(SELECT * FROM Openrowset( Bulk N'D:\一堆測試用的大頭照\Shawn.jpg', Single_Blob) AS pic1 ),
(SELECT * FROM Openrowset( Bulk N'D:\一堆測試用的大頭照\Shawn.jpg', Single_Blob) AS pic2 ),
 GETDATE()
)



參考資料:
Insert Picture into SQL Server 2005 Image Field using only SQL
https://stackoverflow.com/questions/416881/insert-picture-into-sql-server-2005-image-field-using-only-sql