Export Documents from SQL Database to Local PC or Server

  • Thread starter Thread starter manmit.walia
  • Start date Start date
M

manmit.walia

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/code 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
 
yes, to the server. select the rows you want. determine the file name and
extension, open a file and write out the bytes. be sure to up the page
timeout.

-- bruce (sqlwork.com)
 
Hey Thanks Bruce for the quick response,
I understand somewhat, but how will I write the bytes out to a local
pc... DO you have any sample code.

All help is always apperciated.
Manmit
 
Back
Top