Reading HTML file stored as VARBINARY(MAX)

  • Hi,

    We have a table that stores html email templates in varbinary(max) column. We are inserting the html file as follows:

    INSERT INTO ..

    SELECT emailtemplate.BulkColumn,..

    FROM OPENROWSET(BULK 'C:\Email\generic_email_template.txt',

    Single_Blob) AS emailtemplate, ...

    Is there anyway - we can 'see' the content once it's loaded through executing a query/stored procedure?

    Thanks in advance.

    Sabya

    [font="Comic Sans MS"]--
    Sabya[/font]

  • since HTML is text, i would have used a varchar(max) column instead of varbinary(max)

    you can convert to NVarchar(max) to see the contents.

    select CAST(YourVarbinaryColumn as nvarchar(MAX)) From YourTable

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Maybe it too let to acknowledge - but better late than never. Thank you - it worked.

    [font="Comic Sans MS"]--
    Sabya[/font]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply