Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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 09, 2009 10:15 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, April 11, 2014 7:30 AM
Points: 346, Visits: 518
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 09, 2009 10:38 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 4:29 PM
Points: 12,741, Visits: 31,053
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

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
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: Friday, April 11, 2014 7:30 AM
Points: 346, Visits: 518
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