how to extract html files saved in column into html files. Azure blob storage.

  • Hello all,

    I am working in an environment where i inherited bad design. I have a column in a table. This col contains huge HTML files. We are mostly reading these files and very little updates.

    I am changing this whole architecture and going to using Azure Blob storage.

    I am stuck right now. I need to extract these html strings and save them into separate files in year/month/day/filename.html format. I have another column in the table which has create date saved in it.

    I am planning to import all these files into BLOB storage and save link in the table.

    So my issue

    1) How can i extract these strings from the table and save them in the year/month/day/filename.html directory/sub-directory format

    2) How to import these files into BLOB storage.

    Please advice.

    Thanks a ton in advance.

  • so the column containing the HTML is nvarchar(max), i assume, and you are going to spin off the contents to files?

    with the schema of the table, we could give you some example code, and there's several ways to do it;

    This really screams "use the right tool for the right job"

    Doing it on SQL is possible, but not the best way. CLR would make it easier, but you to have that in place already. you really need a proper programming language for this.

    i prefer to write a quick C# as an external program to pull each record, so it can use a filestream to send the data to disk with a specific hierarchy and filename, which can be built as it encoutners the data.

    it would probably be under 60 lines of coding total.

    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!

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

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