Created
March 5, 2019 18:34
-
-
Save mikerodionov/274075f9bacded060586412809671aaf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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