Extract email message from SQL iMAGE Column file
Posted on 2013-11-19
I have uploaded an outlook email message to SQL using:
Column type is 'image'.
SET TextCol = (SELECT *
FROM OPENROWSET(BULK 'C:\test\test.msg',
SINGLE_BLOB) AS x)
WHERE Sequence_Number = 182
Now I want to extract the same file as an outlook email message.
Code I used:
DECLARE @Command NVARCHAR(4000)
SET @Command = 'bcp "SELECT TextCol FROM EsconaTutorial.dbo.AMGR_Letters_Tbl WHERE Sequence_Number = 182" queryout "C:\Test\TEXT.msg" -T -n -S127.0.0.1'
PRINT @Command -- debugging
EXEC xp_cmdshell @Command
I am unable to open the extracted file .
I get "The file may not exist, you may not have permission to open it.