[ACCEPTED]-Which is the best way to store text files into a Sql Server data base, for an asp.net mvc web application?-store
IMAGE are obsolete - do not 20 use them for new development. They will 19 be removed from a future SQL Server version 18 for good.
For SQL Server 2005 and up, use 17
VARCHAR(MAX) / NVARCHAR(MAX) if you're dealing with pure text files 16 (like source code or CSV files), or
VARBINARY(MAX) if 15 you're dealing with binary files.
Those allow 14 up to 2 GB of storage for each single file, and 13 you can use all the usual T-SQL string functions 12 on them to manipulate them (the (N)VARCHAR(MAX) fields, that 11 is).
If you're using SQL Server 2008, there's 10 also an additional option - the
FILESTREAM attribute 9 on
VARBINARY(MAX) columns. This allows you to store the 8 files in the SQL Server machine's file system 7 (instead of the database tables) while preserving 6 transactional and data integrity.
FILESTREAM 5 is recommended for files that are typically 4 and usually larger than 1 MB in size, or 3 if you ever need more than 2 GB (since you 2 can't store more than 2 GB in a regular 1
More Related questions