Is there a way to insert binary data into sql server directly f开发者_StackOverflow中文版rom SQL Server management studio?
Found the answer:
SQL Server has an "OPENROWSET" command that accepts a filepath.
eg
Update myTable
set Image = (
SELECT *
FROM OPENROWSET(BULK N'C:\image.png', SINGLE_BLOB) test)
where ImageID = 1
Source: http://shortfastcode.blogspot.com/2009/12/insert-binary-data-like-images-into-sql.html
Try this:
INSERT INTO Table (field1) VALUES (0xABCDEF)
Where 0xABCDEF
is your binary data represented as an hexadecimal sequence.
I found no way to upload/download binary file from SSMS GUI without script.
So I switch to MySQL with Workbench. From their table editor, for a BLOB column, in the context menu, there are Load Value From File...
and Save Value To File...
options.
精彩评论