简体   繁体   中英

Storing and retrieving any shots of file extension in a SQL Server database

I am writing an asp.net web application that stores APPLICANTS data in a SQL Server database. Applicant might post name, address, telephone and a file.

The file might be of any extension including .docx for resume, ' jpg , .pdf for photos. or even an Excel file.

Is it possible to store all these file extension on my database?

Or will that be lengthy?

Please help

Good question! Personally I would use FILESTREAM in your case and here's why

In SQL Server, BLOBs can be standard varbinary(max) data that stores the data in tables, or FILESTREAM varbinary(max) objects that store the data in the file system. The size and use of the data determines whether you should use database storage or file system storage. If the following conditions are true, you should consider using FILESTREAM:

  • Objects that are being stored are, on average, larger than 1 MB.
  • Fast read access is important.
  • You are developing applications that use a middle tier for application logic.

For smaller objects, storing varbinary(max) BLOBs in the database often provides better streaming performance.

You can read up on FILESTREAM here .

Also consider using it in conjunction with FILETABLE .

Finally, here's a .net C# example on how to read from FILESTREAM column.

Please note, FILESTREAM is available in SQL Server starting from 2008 version.

Hope it helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM