{"id":601,"date":"2019-11-15T12:08:17","date_gmt":"2019-11-15T04:08:17","guid":{"rendered":"http:\/\/www.yohz.com\/blogs\/?p=601"},"modified":"2019-11-15T12:08:17","modified_gmt":"2019-11-15T04:08:17","slug":"sql-blob-to-file","status":"publish","type":"post","link":"https:\/\/www.yohz.com\/blogs\/2019\/11\/15\/sql-blob-to-file\/","title":{"rendered":"SQL blob to file"},"content":{"rendered":"<p>This post shows you how to export and extract your SQL blob to file using <a href=\"https:\/\/www.yohz.com\/sbe_details.htm\">SQL Blob Export<\/a>.\u00a0 You can download a free 14-day trial <a href=\"http:\/\/www.yohz.com\/downloads\/sqlblobexport\/SQLBlobExportSetup.zip\">here<\/a>.<\/p>\n<p>Start <a href=\"https:\/\/www.yohz.com\/sbe_details.htm\">SQL Blob Export<\/a>, and click on the <strong>Export images and files<\/strong> item.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-602\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_01.png\" alt=\"\" width=\"786\" height=\"693\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_01.png 786w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_01-300x265.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_01-768x677.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_01-624x550.png 624w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/p>\n<p>Enter your project details if you plan to reuse the export settings.\u00a0 Otherwise, you can just accept the default values.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-603\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_02.png\" alt=\"\" width=\"786\" height=\"693\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_02.png 786w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_02-300x265.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_02-768x677.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_02-624x550.png 624w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/p>\n<p>Enter the connection details to connect to your database server.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-604\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_03.png\" alt=\"\" width=\"786\" height=\"693\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_03.png 786w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_03-300x265.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_03-768x677.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_03-624x550.png 624w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/p>\n<p>Select the table you want to export your blobs from.\u00a0 Tables containing blob columns are highlighted in green.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-605\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_04.png\" alt=\"\" width=\"786\" height=\"693\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_04.png 786w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_04-300x265.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_04-768x677.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_04-624x550.png 624w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/p>\n<p>You can also enter a SQL command to select the blobs you want to export.\u00a0 We will use the following SQL command to retrieve our blobs.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-606\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_05.png\" alt=\"\" width=\"786\" height=\"693\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_05.png 786w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_05-300x265.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_05-768x677.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_05-624x550.png 624w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/p>\n<p>Now you need to tell <a href=\"https:\/\/www.yohz.com\/sbe_details.htm\">SQL Blob Export<\/a> how to name the exported files.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-607\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06.png\" alt=\"\" width=\"786\" height=\"693\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06.png 786w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06-300x265.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06-768x677.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06-624x550.png 624w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/p>\n<p>Enter the folder to store the files in.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-608\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06_1.png\" alt=\"\" width=\"547\" height=\"103\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06_1.png 547w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06_1-300x56.png 300w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/p>\n<p>You can ignore the <strong>OLE Object types<\/strong> section if your blobs are not stored in <a href=\"https:\/\/www.yohz.com\/blogs\/2017\/11\/17\/exporting-and-extracting-images-and-files-from-microsoft-access-databases\/\">Microsoft Access OLE Object-type fields<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-609\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06_2.png\" alt=\"\" width=\"547\" height=\"153\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06_2.png 547w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06_2-300x84.png 300w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/p>\n<p>In the <strong>Other types<\/strong> section, enter the naming convention for your files.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-610\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06_3.png\" alt=\"\" width=\"547\" height=\"182\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06_3.png 547w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_06_3-300x100.png 300w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/p>\n<p>We use the value <strong>&lt;ProductPhotoID:0000&gt;_&lt;%column%&gt;<\/strong> to name our files.\u00a0 <strong>&lt;ProductPhotoID&gt;<\/strong> is one of the columns we retrieved using our SQL command, and is a number.\u00a0 The suffix <strong>:0000<\/strong> means we want SQL Blob Export to format the number to 4 digits e.g. 14 is formatted to 0014, 234 is formatted to 0234 etc.<\/p>\n<p>We can use any column names to name our exported file, as long as the column exists in the table we chose to export, or is a column retrieved by our SQL command.<\/p>\n<p>The <strong>&lt;%column%&gt;<\/strong> value is a system value indicating the index of the column storing the blob.\u00a0 Remember that our SQL command selects 2 blob columns (<strong>ThumbnailPhoto<\/strong> and <strong>LargePhoto<\/strong>), so our naming convention needs to be able to identify from which column the file was extracted from.<\/p>\n<p>Once we have set up our export options, SQL Blob Export will extract the SQL blob to file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-612\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_07-1.png\" alt=\"\" width=\"786\" height=\"693\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_07-1.png 786w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_07-1-300x265.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_07-1-768x677.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2019\/11\/sbe_07-1-624x550.png 624w\" sizes=\"(max-width: 786px) 100vw, 786px\" \/><\/p>\n<p>One important thing you should note is that <strong>we did not tell SQL Blob Export the type of blob that&#8217;s stored in our table<\/strong>.\u00a0 <a href=\"https:\/\/www.yohz.com\/sbe_details.htm\">SQL Blob Export<\/a> can identify the blob type and use the correct file extension accordingly.\u00a0 It can identify most image formats (jpg, png, tif, bmp, gif, tga, emf, wmf), Office files (doc, docs, xls, xlsx, ppt, pptx), Open Office files, PDFs, and many more.\u00a0 For a complete list of recognised file types, see <a href=\"https:\/\/www.yohz.com\/help\/accessoleexport\/index.htm?supported_file_types.htm\">here<\/a>.<\/p>\n<div class=\"fcbkbttn_buttons_block\" id=\"fcbkbttn_left\"><div class=\"fcbkbttn_like \"><fb:like href=\"https:\/\/www.yohz.com\/blogs\/2019\/11\/15\/sql-blob-to-file\/\" action=\"like\" colorscheme=\"light\" layout=\"button\"  size=\"small\"><\/fb:like><\/div><div class=\"fb-share-button  \" data-href=\"https:\/\/www.yohz.com\/blogs\/2019\/11\/15\/sql-blob-to-file\/\" data-type=\"button\" data-size=\"small\"><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>This post shows you how to export and extract your SQL blob to file using SQL Blob Export.\u00a0 You can download a free 14-day trial here. Start SQL Blob Export, and click on the Export images and files item. Enter your project details if you plan to reuse the export settings.\u00a0 Otherwise, you can just [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[44],"tags":[78,79,76,77,81,80,8,48,75,35],"_links":{"self":[{"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/posts\/601"}],"collection":[{"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/comments?post=601"}],"version-history":[{"count":1,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/posts\/601\/revisions"}],"predecessor-version":[{"id":613,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/posts\/601\/revisions\/613"}],"wp:attachment":[{"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/media?parent=601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/categories?post=601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/tags?post=601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}