467,925 Members | 2,026 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,925 developers. It's quick & easy.

Export Image Data Types to Local PC from SQL Database

Hello All,
I am stuck on a task that I need to complete. What I have is a SQL 2005
DB running with a Table called Docs. The table structure consists of
the following:

Table Structure for Docs
------------------------------------
DocID int - Primary Key
ClientID int - CustomerID
CreatedByUser nvarchar - UserName
CreatedDate datetime - Date of Document stored in SQL DB
Content image - Bytes of actually document
ContentType nvarchar - (application/msword)
ContentTypeImage nvarchar - Path to Image of Document Type(such as
word.gif")
ContentSize int - Size of Document
FriendlyName nvarchar - Name of Document

What I want to do is create a query to export all documents from the
SQL DB to a local folder on the server or even my local pc. Can this be
done?

Thanks

Jun 29 '06 #1
  • viewed: 3222
Share:
1 Reply
(ma**********@gmail.com) writes:
I am stuck on a task that I need to complete. What I have is a SQL 2005
DB running with a Table called Docs. The table structure consists of
the following:

Table Structure for Docs
------------------------------------
DocID int - Primary Key
ClientID int - CustomerID
CreatedByUser nvarchar - UserName
CreatedDate datetime - Date of Document stored in SQL DB
Content image - Bytes of actually document
ContentType nvarchar - (application/msword)
ContentTypeImage nvarchar - Path to Image of Document Type(such as
word.gif")
ContentSize int - Size of Document
FriendlyName nvarchar - Name of Document

What I want to do is create a query to export all documents from the
SQL DB to a local folder on the server or even my local pc. Can this be
done?


First of all, if you are at the position of changing the table schema,
I recommend that you change the data type of image to varbinary(MAX).
varbinary(MAX) permits as much data as image, but is very much like a
require varbinary, and has none of the many quirks with image.

To answer the question, no, you can't just say SELECT and have
files created in the file system. You would need to write a program
to read the column and write the binary value to disk.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 29 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by dave | last post: by
11 posts views Thread by Mike MacSween | last post: by
6 posts views Thread by maricel | last post: by
16 posts views Thread by David Lauberts | last post: by
6 posts views Thread by Chris Cox | last post: by
35 posts views Thread by Stan Sainte-Rose | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.