<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic CAD file export from SQL BLOB in Windchill</title>
    <link>https://www.ptcusercommunity.com/t5/Windchill/CAD-file-export-from-SQL-BLOB/m-p/557924#M57358</link>
    <description>&lt;P&gt;One of our legacy systems has crashed that was running Windchill 9.1 M050 software but the SQL system is still functioning. It appears that there was no backup. What I’m trying to do is export the CAD data from the SQL database. It appears that the database was never setup right as all the files are stared in BLOB in the database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’ve been able to write the query below that relates the columns from the tables in the database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I’m unsure of is how to get a usable file out of the BLOB data and write it to a file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I’ve read is that it must be converted to something varbianary&amp;gt;bianary&amp;gt;hex or something?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--query binding tables--&lt;/P&gt;
&lt;P&gt;select&lt;/P&gt;
&lt;P&gt;ad.fileName --table column with file name--&lt;/P&gt;
&lt;P&gt;, sd.lobLoc --table column with file data this needs to be contents of file--&lt;/P&gt;
&lt;P&gt;, e.nameB2folderingInfo --table column with folder name I’d be happy if everything was in a single folder this would just be nice to separate it to sub folders--&lt;/P&gt;
&lt;P&gt;from&lt;/P&gt;
&lt;P&gt;--everything below relates the above three table columns--&lt;/P&gt;
&lt;P&gt;&amp;nbsp;wcadmin.EPMDocument e&lt;/P&gt;
&lt;P&gt;, wcadmin.EPMDocumentMaster m&lt;/P&gt;
&lt;P&gt;, wcadmin.HolderToContent h&lt;/P&gt;
&lt;P&gt;, wcadmin.ApplicationData ad&lt;/P&gt;
&lt;P&gt;, wcadmin.StreamData sd&lt;/P&gt;
&lt;P&gt;where e.latestiterationInfo='1'&lt;/P&gt;
&lt;P&gt;and e.idA2A2=h.idA3A5&lt;/P&gt;
&lt;P&gt;and h.idA3B5=ad.idA2A2&lt;/P&gt;
&lt;P&gt;and e.idA3masterReference=m.idA2A2&lt;/P&gt;
&lt;P&gt;and ad.idA3A5 = sd.idA2A2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’m not an expert in SQL I’m just a design engineer that is trying to recover the old data.&lt;/P&gt;
&lt;P&gt;Thanks for any and all help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Greg&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jun 2018 13:26:57 GMT</pubDate>
    <dc:creator>mulleg</dc:creator>
    <dc:date>2018-06-27T13:26:57Z</dc:date>
    <item>
      <title>CAD file export from SQL BLOB</title>
      <link>https://www.ptcusercommunity.com/t5/Windchill/CAD-file-export-from-SQL-BLOB/m-p/557924#M57358</link>
      <description>&lt;P&gt;One of our legacy systems has crashed that was running Windchill 9.1 M050 software but the SQL system is still functioning. It appears that there was no backup. What I’m trying to do is export the CAD data from the SQL database. It appears that the database was never setup right as all the files are stared in BLOB in the database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’ve been able to write the query below that relates the columns from the tables in the database.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I’m unsure of is how to get a usable file out of the BLOB data and write it to a file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I’ve read is that it must be converted to something varbianary&amp;gt;bianary&amp;gt;hex or something?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;--query binding tables--&lt;/P&gt;
&lt;P&gt;select&lt;/P&gt;
&lt;P&gt;ad.fileName --table column with file name--&lt;/P&gt;
&lt;P&gt;, sd.lobLoc --table column with file data this needs to be contents of file--&lt;/P&gt;
&lt;P&gt;, e.nameB2folderingInfo --table column with folder name I’d be happy if everything was in a single folder this would just be nice to separate it to sub folders--&lt;/P&gt;
&lt;P&gt;from&lt;/P&gt;
&lt;P&gt;--everything below relates the above three table columns--&lt;/P&gt;
&lt;P&gt;&amp;nbsp;wcadmin.EPMDocument e&lt;/P&gt;
&lt;P&gt;, wcadmin.EPMDocumentMaster m&lt;/P&gt;
&lt;P&gt;, wcadmin.HolderToContent h&lt;/P&gt;
&lt;P&gt;, wcadmin.ApplicationData ad&lt;/P&gt;
&lt;P&gt;, wcadmin.StreamData sd&lt;/P&gt;
&lt;P&gt;where e.latestiterationInfo='1'&lt;/P&gt;
&lt;P&gt;and e.idA2A2=h.idA3A5&lt;/P&gt;
&lt;P&gt;and h.idA3B5=ad.idA2A2&lt;/P&gt;
&lt;P&gt;and e.idA3masterReference=m.idA2A2&lt;/P&gt;
&lt;P&gt;and ad.idA3A5 = sd.idA2A2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I’m not an expert in SQL I’m just a design engineer that is trying to recover the old data.&lt;/P&gt;
&lt;P&gt;Thanks for any and all help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Greg&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 13:26:57 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Windchill/CAD-file-export-from-SQL-BLOB/m-p/557924#M57358</guid>
      <dc:creator>mulleg</dc:creator>
      <dc:date>2018-06-27T13:26:57Z</dc:date>
    </item>
  </channel>
</rss>

