jeudi 29 mai 2014

c# - type de données pour stocker des pdf dans la table sql - Stack Overflow


I would like to insert a pdf into a column of a sql table.


I have defined a varbinary(max) datatype for this column.


When I open this pdf in notepad++, it starts with something like this


%PDF-1.6 %äãÏÒ 1 0 obj [/PDF/ImageB/ImageC/ImageI/Text] endobj 3 0 obj <


This doesn't seem to be in binary format.


How can I insert a pdf which looks like the above format in a sql column and of what datatype?




You can use varchar(max) to store this. I've a application and i'm storing with varchar(max) and its working fine.




This answer goes to great lengths about pros and cons of storing binary files in database. And there are the following advice given:



SQL 2008 has a thing called FILESTREAM which combines both worlds. You upload to the database and it transparently stores the files in a directory on disk. When retrieving you can either pull from the database; or you can go direct to where it lives on the file system.




I would like to insert a pdf into a column of a sql table.


I have defined a varbinary(max) datatype for this column.


When I open this pdf in notepad++, it starts with something like this


%PDF-1.6 %äãÏÒ 1 0 obj [/PDF/ImageB/ImageC/ImageI/Text] endobj 3 0 obj <


This doesn't seem to be in binary format.


How can I insert a pdf which looks like the above format in a sql column and of what datatype?



You can use varchar(max) to store this. I've a application and i'm storing with varchar(max) and its working fine.



This answer goes to great lengths about pros and cons of storing binary files in database. And there are the following advice given:



SQL 2008 has a thing called FILESTREAM which combines both worlds. You upload to the database and it transparently stores the files in a directory on disk. When retrieving you can either pull from the database; or you can go direct to where it lives on the file system.



0 commentaires:

Enregistrer un commentaire