0

Is is a good idea to store an HTML string as blob data in SQL server or should we keep it as a string? Currently, we do not have a need to search the data in the HTML. Also, for security reasons we do not want to store the files on the file system or any external storage. That is why we have opted for storing the data in SQL.

I'd like to know if there is significant overhead to store this type of data as a blob or if we should just keep it as plain text in the database.

I do not feel this is a duplicate question as I am asking if storing HTML as a blob is a good idea or not. I found this question, while it pertains to MySQL, perhaps it could be applied to SQL Server. Could there be a legitimate use for blobs and HTML?

Community
  • 1
  • 1
DDiVita
  • 4,225
  • 5
  • 63
  • 117
  • 1
    What BLOB type are you considering? and why are you considering it over a character type? – Alex K. Mar 11 '14 at 17:24
  • @AlexK., that is sort of my question. I want to know if it is better to store large amounts of HTML as blob or say as text. – DDiVita Mar 11 '14 at 17:32
  • Have a look at this answer I explained why it is not a good answer to store html blob and how easy it is to render html at runtime from sql server. [`Storing data for HTML Tables`](http://stackoverflow.com/questions/21120505/storing-data-for-html-tables-in-database) – M.Ali Mar 11 '14 at 17:35

1 Answers1

1

It's (presumably) guaranteed to always textual data so there is little point in considering a binary type.

Classical blob types like IMAGE/TEXT are depreciated and should be avoided, instead if you are constrained by the maximum limit of a N/VARCHAR look at VARCHAR(MAX) or of the current BLOB offerings FILETABLE.

Community
  • 1
  • 1
Alex K.
  • 171,639
  • 30
  • 264
  • 288