2 Replies - 225 Views - Last Post: 25 November 2019 - 10:28 AM Rate Topic: -----

#1 aspfun   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 135
  • Joined: 16-January 13

What is the best way to insert pdf/doc/xls/jpg file into a SQL table?

Posted 25 November 2019 - 09:58 AM

In a winform project, I need to code to insert pdf/doc/xls/jpg file into a SQL table.
What is the best way to complete it?
Is This A Good Question/Topic? 0
  • +

Replies To: What is the best way to insert pdf/doc/xls/jpg file into a SQL table?

#2 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6833
  • View blog
  • Posts: 28,342
  • Joined: 12-December 12

Re: What is the best way to insert pdf/doc/xls/jpg file into a SQL table?

Posted 25 November 2019 - 10:26 AM

What have you found out so far?

It is preferable not to save such data to a database, but to store enough information to be able to retrieve and download such files from a secure file system store.
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15497
  • View blog
  • Posts: 62,056
  • Joined: 12-June 08

Re: What is the best way to insert pdf/doc/xls/jpg file into a SQL table?

Posted 25 November 2019 - 10:28 AM

I concur.. databases are not file storage systems.

That being said I have been overruled by higher ups before to counter this so the best way is to store them as a byte array into a varbinary(max) column and the file name in a varchar field.

If you look at my contributions in my profile there's a snippet to convert a file to binary array.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1