不曉得這是不是你要的,你可以透過OPENROWSET開啟檔案,然後將之INSERT到FileStream資料行。
-- Declare a variable to store the image data
DECLARE @img AS VARBINARY(MAX)
-- Load the image data
SELECT @img = CAST(bulkcolumn AS VARBINARY(MAX))
FROM OPENROWSET(
BULK
'C:\temp\MicrosoftMouse.jpg',
SINGLE_BLOB ) AS x
-- Insert the data to the table
INSERT INTO Items (ItemID, ItemNumber, ItemDescription, ItemImage)
SELECT NEWID(), 'MS1001','Microsoft Mouse', @img
https://www.simple-talk.com/sql/learn-sql-server/an-introduction-to-sql-server-filestream/
以上說明若有錯誤請指教,謝謝。
| 台灣 SQL PASS 社群 |
SQL PASS Taiwan
|
歡迎參觀我的BLOG - 積沙成塔