(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