I want to store a webpage in Sql Server
. The page may contain images and other stuff. What data type should I use? As mentioned here, ntext, text, and image data types will be removed in the future versions of SQL Server
. What data type can be used to store HTML
files which have different stuff like images and things like JavaScript
codes?
Since you want to store both the HTML of the web page as well as the images, you might want to consider storing the images in the file system instead. Here is a comparison of the advantages and disadvantages of both options:
If you decide to store them in the DB, the appropriate data types are:
nvarchar(MAX)
for the HTML text and varbinary(MAX)
for the images.I could store them in the DB, by
using nvarchar(MAX)
. it has stored the data as well as retrieved data with the image.
My objective was to copy and paste emails received. These emails can have HTML tags and can also have images. I tried it with nvarchar(max)
and it worked.
I am using VB6 as a development tool. The only problem I found was I could not store it with stored procedures passing the values through addParameter.
I have stored it with traditional saving mechanism from VB6
With Recordset<br>
.addnewM<br>
.Fields("MailBody")<br>
.Update<br>
End With<br>
If anyone gets idea of storing using the stored procedure, let me know
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With