Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several files on a webserver (not stored in the database). I'd like to store several information to this specific file. The user should be able to post comments about this file.

My question is:

What is the best way in order to store information in a database in addition to a file that is stored on a webserver... How do I connect both parts?

share|improve this question
My first thought was to create a table with two columns, one fo the filepath, another to store comments. If you need multiple comments for each file, then you need to have a slightly different table(s) design. – SQLRockstar Nov 28 '12 at 14:01
@SQLRockstar: Why not write a full answer? – FrustratedWithFormsDesigner Nov 28 '12 at 16:57
@Daniel: What are you tring to accomplish? This type of design probably isn't a good idea. – Jon Seigel Nov 28 '12 at 18:06
Do you mean "store information about this specific file"? Or are you talking about writing data to the file itself? – mdoyle Nov 28 '12 at 20:41
@Jon: This is exactly what I think as well. Might not be a good idea, but I have no idea how to do this in a different way. What I'm trying to do is to build up a WebDav server, where files will be stored by the user. Those files are supposed to be listed/presented on a website. The user should be able to search for those files, comment them, etc. Unfortunately... in the moment when those files will be "uploaded"/created on the server, they are getting random names like "ASD564A8A6S54EASEAS864.doc", so in this exact moment I don't even know the name of this file. – Daniel Nov 29 '12 at 7:40

For a SQL Server solution, FILESTREAM (or FILETABLE if you can use SQL Server 2012) was built to solve this type of problem.

This solution will allow you to store the files in a central network location (most importantly, not on a web server box) outside the database, and manipulate metadata information within the database.

As mentioned in my comment, other RDBMS systems may also have similar capabilities (I'm not familiar enough with them to say, though).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.