{"id":88,"date":"2011-06-14T08:49:04","date_gmt":"2011-06-14T06:49:04","guid":{"rendered":"http:\/\/blog.blaten.nl\/?p=88"},"modified":"2011-06-14T08:49:04","modified_gmt":"2011-06-14T06:49:04","slug":"sql-load-image-from-file","status":"publish","type":"post","link":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/","title":{"rendered":"SQL load image from file"},"content":{"rendered":"<p>Once in a while my colleagues ask me to change a jpeg image stored in a databaserecord, and every single time they ask I need to search all my sql files to find the query needed to do this.<\/p>\n<p>Maybe I&#8217;m not the only one who needs this, that&#8217;s why I&#8217;m posting my solution here&#8230; have fun with it&#8230;<\/p>\n<pre class=\"syntax sql\">\nupdate [schema].[table_containing_image_record]\nSET [Image_field] = (SELECT BulkColumn FROM OPENROWSET(Bulk '[ full path to file on sql server drive ]', SINGLE_BLOB) AS BLOB)\nwhere [selection criteria]\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Once in a while my colleagues ask me to change a jpeg image stored in a databaserecord, and every single time they ask I need to search all my sql files to find the query needed to do this. Maybe I&#8217;m not the only one who needs this, that&#8217;s why I&#8217;m posting my solution here&#8230; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[7,1],"tags":[14],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL load image from file &raquo; Christiaan Nieuwlaat .nl<\/title>\n<meta name=\"description\" content=\"Quick snippet on how to load an image into a sql server record.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL load image from file &raquo; Christiaan Nieuwlaat .nl\" \/>\n<meta property=\"og:description\" content=\"Quick snippet on how to load an image into a sql server record.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/\" \/>\n<meta property=\"og:site_name\" content=\"Christiaan Nieuwlaat .nl\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/christiaan.nieuwlaat\" \/>\n<meta property=\"article:published_time\" content=\"2011-06-14T06:49:04+00:00\" \/>\n<meta name=\"author\" content=\"chris\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@krizzje\" \/>\n<meta name=\"twitter:site\" content=\"@krizzje\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"chris\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/\",\"url\":\"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/\",\"name\":\"SQL load image from file &raquo; Christiaan Nieuwlaat .nl\",\"isPartOf\":{\"@id\":\"https:\/\/www.christiaannieuwlaat.nl\/#website\"},\"datePublished\":\"2011-06-14T06:49:04+00:00\",\"dateModified\":\"2011-06-14T06:49:04+00:00\",\"author\":{\"@id\":\"https:\/\/www.christiaannieuwlaat.nl\/#\/schema\/person\/db0e2d25ff2c1c9a5c2f86c22081bbef\"},\"description\":\"Quick snippet on how to load an image into a sql server record.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.christiaannieuwlaat.nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL load image from file\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.christiaannieuwlaat.nl\/#website\",\"url\":\"https:\/\/www.christiaannieuwlaat.nl\/\",\"name\":\"Christiaan Nieuwlaat .nl\",\"description\":\"IT Whizzkid behind the wheels of steel\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.christiaannieuwlaat.nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.christiaannieuwlaat.nl\/#\/schema\/person\/db0e2d25ff2c1c9a5c2f86c22081bbef\",\"name\":\"chris\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.christiaannieuwlaat.nl\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7e1e034197de6790df1ed0095c77a136?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7e1e034197de6790df1ed0095c77a136?s=96&d=mm&r=g\",\"caption\":\"chris\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL load image from file &raquo; Christiaan Nieuwlaat .nl","description":"Quick snippet on how to load an image into a sql server record.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/","og_locale":"en_US","og_type":"article","og_title":"SQL load image from file &raquo; Christiaan Nieuwlaat .nl","og_description":"Quick snippet on how to load an image into a sql server record.","og_url":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/","og_site_name":"Christiaan Nieuwlaat .nl","article_publisher":"https:\/\/www.facebook.com\/christiaan.nieuwlaat","article_published_time":"2011-06-14T06:49:04+00:00","author":"chris","twitter_card":"summary_large_image","twitter_creator":"@krizzje","twitter_site":"@krizzje","twitter_misc":{"Written by":"chris"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/","url":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/","name":"SQL load image from file &raquo; Christiaan Nieuwlaat .nl","isPartOf":{"@id":"https:\/\/www.christiaannieuwlaat.nl\/#website"},"datePublished":"2011-06-14T06:49:04+00:00","dateModified":"2011-06-14T06:49:04+00:00","author":{"@id":"https:\/\/www.christiaannieuwlaat.nl\/#\/schema\/person\/db0e2d25ff2c1c9a5c2f86c22081bbef"},"description":"Quick snippet on how to load an image into a sql server record.","breadcrumb":{"@id":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/2011\/06\/14\/sql-load-image-from-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.christiaannieuwlaat.nl\/"},{"@type":"ListItem","position":2,"name":"SQL load image from file"}]},{"@type":"WebSite","@id":"https:\/\/www.christiaannieuwlaat.nl\/#website","url":"https:\/\/www.christiaannieuwlaat.nl\/","name":"Christiaan Nieuwlaat .nl","description":"IT Whizzkid behind the wheels of steel","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.christiaannieuwlaat.nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.christiaannieuwlaat.nl\/#\/schema\/person\/db0e2d25ff2c1c9a5c2f86c22081bbef","name":"chris","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.christiaannieuwlaat.nl\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7e1e034197de6790df1ed0095c77a136?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7e1e034197de6790df1ed0095c77a136?s=96&d=mm&r=g","caption":"chris"}}]}},"_links":{"self":[{"href":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/wp-json\/wp\/v2\/posts\/88"}],"collection":[{"href":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/wp-json\/wp\/v2\/comments?post=88"}],"version-history":[{"count":0,"href":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/wp-json\/wp\/v2\/posts\/88\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/wp-json\/wp\/v2\/media?parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/wp-json\/wp\/v2\/categories?post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.christiaannieuwlaat.nl\/index.php\/wp-json\/wp\/v2\/tags?post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}