Latest post

SQL to INSERT file to table

I use this snippet to add any kinds of files to my database table which has a "image" data type.




insert into [TableName] (Content) 
SELECT BulkColumn FROM Openrowset(Bulk 'C:\temp\FileToUplaod.xls', Single_Blob) as img

The path "C:\temp\FileToUpload.xls" refers to the path located in the database server, therefore you need access the server (e.g. Remote Access, UNC, etc..)

If your SQL server is installed in your local machine then that will be your computer's "C:\temp..." folder.

Comments

Popular posts from this blog

Entity Framework Core Custom Pluralizer - .Net Core