Hi,
I hope someone can point me to the right direction.
The application I am working on is a database program where I use SQL Server 2005 and multiple Windows Forms based clients that connect to it to store/retrieve data. The data includes attachments (same as email, any kind of file(s)). From other posts, I can see that, overall, saving the files on a disk and the links to the files on SQL Server is a better approach. My trouble is with the actual storing and serving those files to the clients in an efficient manner.
Which is better/possible:
- Doing storing and retrieving of files with SQLCLR. In this case, how can I read the files to SQL Server, and stream them to my clients
- Developing a server program that would run on the same machine as SQL Server and do these jobs, as well as be an access point to the clients.
Also, regarding the file storage, I decided to use GUID for saved file names. Which is better
- Saving the original file name, path on SQL Server, and renaming saved files with GUIDs;
- How about, instead of changing the file names, storing each file with original name under subfolders whose names are GUID That way, we could omit renaming files (unless there is minimum subfolder limitation or other gotchas that I am not aware of). I have seen the first approach in some commercial applications, however I would love to know the reason why naming files with GUIDs and do more operations is better than just naming folders with GUIDs (similar to XP Embedded Dev. Studio Database storing component files (drivers, apps, etc.).
I would appreciate if someone could offer practical help with sample code, tutorials or other articles. Thank you for any help in advance!
Migrant

Storing/Retrieving Various File Formats in DB Application
Theron
Hello Migrant,
there was an interesting article about efficiently storing files in SQL Server using a blobstream in the .Net magazine.
Check it out:
http://www.microsoft.com/netherlands/msdn/netmagazine/code/magazine12.aspx
Edit:
Forgot not everyone in the world speaks dutch, yet.
But there are some really nice code sniplets in there.