Export Documents from SQL Database to Local PC or Server

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
 
B

bruce barker \(sqlwork.com\)

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)
 
M

manmit.walia

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top