Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Reading HTML file stored as VARBINARY(MAX) Expand / Collapse
Author
Message
Posted Thursday, April 9, 2009 10:15 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, October 8, 2015 11:18 PM
Points: 346, Visits: 524
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





--
Sabya
Post #694176
Posted Thursday, April 9, 2009 10:38 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 9:27 AM
Points: 14,556, Visits: 38,440
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!
Post #694204
Posted Thursday, November 19, 2009 12:46 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, October 8, 2015 11:18 PM
Points: 346, Visits: 524
Maybe it too let to acknowledge - but better late than never. Thank you - it worked.

--
Sabya
Post #821895
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse