• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 841
  • Last Modified:

Extract attachments from mssql

I've got a table in a mssql database that stores attachemnts of varying filetypes (.pdf, .doc, .ppt, .msg).  I need to extract all of these files out of the database and into a folder on my hard drive.  I'm running SQL Server 2008 Enterprise Edition.  

I was looking to avoid writing code, but I dont' seem to be having much luck finding an app that will do this for me.  Anyone know of an app that work, or have a coding solution?  
Here's the makup of the table:

CREATE TABLE [dbo].[FileSystem](
      [AttachmentID] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
      [FileData] [image] NULL,
      [DataTypeColumn] [varchar](4) NULL,
 CONSTRAINT [PK_FileSystem] PRIMARY KEY CLUSTERED
(
      [AttachmentID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
0
moore315
Asked:
moore315
1 Solution
 
RiteshShahCommented:
I have one example in my blog,

"Image store in database and retrieve it back"

http://www.sqlhub.com/2009/03/image-store-in-sql-server-2005-database.html
0
 
Om PrakashCommented:
You can write .NET code to retreive image and store.

Example to read image from DB
http://authors.aspalliance.com/das/readimage.aspx
You can modify this code to save image in a specific folder.
0
 
Marten RuneSQL Expert/Infrastructure ArchitectCommented:
If you dont use .NET and prefere a VBScript. I can provide with one!

But I need to understand  [DataTypeColumn] , is this file suffix? i e '.JPG' or '.ZIP' etc in order to customize the code for you.

And where is your filename??? Does it matter or is it not stored in the database?

//Marten
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now