Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikerodionov/274075f9bacded060586412809671aaf to your computer and use it in GitHub Desktop.
Save mikerodionov/274075f9bacded060586412809671aaf to your computer and use it in GitHub Desktop.
USE [TEST_DB]
--Example 1- Insert JPG file into FileStream column:
INSERT TestTable(DocumentNumber, DocumentBody)
VALUES
(1, (SELECT * FROM OPENROWSET (BULK 'C:\Images\Sample_Image.jpg', SINGLE_BLOB) document));
--Example 2 - Convert text into binary format:
INSERT INTO TestTable(DocumentNumber, DocumentBody)
VALUES (2, CONVERT(VARBINARY(MAX), 'Hello World'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment