467,915 Members | 1,181 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Export Documents from SQL Database to Local PC or Server

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

Jun 29 '06 #1
  • viewed: 1477
Share:
2 Replies
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)
<ma**********@gmail.com> wrote in message
news:11**********************@75g2000cwc.googlegro ups.com...
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

Jun 29 '06 #2
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

bruce barker (sqlwork.com) wrote:
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)
<ma**********@gmail.com> wrote in message
news:11**********************@75g2000cwc.googlegro ups.com...
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


Jun 30 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Mike MacSween | last post: by
1 post views Thread by frankvfox | last post: by
6 posts views Thread by maricel | last post: by
4 posts views Thread by Agnes | last post: by
reply views Thread by sameer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.