Solved

Extract email message from SQL iMAGE Column file

Posted on 2013-11-19
1
349 Views
Last Modified: 2013-11-21
HI

I have uploaded an outlook email message to SQL using:

Column type is 'image'.

UPDATE dbo.AMGR_Letters_Tbl
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
GO

I am unable to open the extracted file .

I get "The file may not exist, you may not have permission to open it.

Thanks,
Shezad
0
Comment
Question by:Shezad Ahmed
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 43

Accepted Solution

by:
Eugene Z earned 500 total points
ID: 39664588
try to use sql format file
see this step=by-step  example how to export image datatype from sql by using bcp
http://ayesamson.com/2012/06/06/exporting-photos-with-bcp/
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server sp_executesql / Change Tracking Version() results into variable 4 30
VMware PVSCSI SQL Server 2016 AlwaysOn 2 37
mssql 7 32
t-sql left join 2 34
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question