I am trying to store a file in a SQL Server 2008 database. Since the size of file is small, performance is not an issue.
My table has this 3 columns:
filename nvarchar(50)
extension nvarchar(5)
content image
How to write a SQL statement to insert a file into this database?
MS has an article on How to upload files to the server using classic asp. (see here) once you have the file on your server then you can just add it into the db.
But remember storing binary data in a database is usually a bad idea
but then again if it’s something super small then try it! for example I think you can just insert it into a varbinary(max) column:
example:
Also see: How To Display Images Stored in a BLOB Field. http://support.microsoft.com/kb/173308 This technique can also be applied to other types of binary data, not just graphics.
Good Luck…