I need a way to read the contents of a HTML file and return it as a column within a SQL server query.
To set the scene I’m working on a query that gathers all the data needed to export products from an ERP system and import it into eBay, but I need to store the product descriptions in a HTML file.
At part of the query, I need to read the content of that HTML file for each product SKU
The below isn’t correct SQL but should give an idea of what I’m trying to do:
SELECT '<HTML FILE CONTENTS>' as Description
The filename would be the same as the product SKU in the table and all files would be in the same folder, so I’d need to contaminate that into the file path.
Is this possible?
2
Answers
I've managed to do this using the below if anyones interested :)
I don’t think that’s possible in TSQL. How do you process the data after you have retrieved it? If you are using a programme, I would load the data into a List of objects and than loop over the objects and read the description from the HTML files separately.