﻿
{"id":5355,"date":"2016-11-13T17:22:37","date_gmt":"2016-11-13T17:22:37","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=5355"},"modified":"2016-11-13T17:22:37","modified_gmt":"2016-11-13T17:22:37","slug":"sql-server-2016-openjson-fonksiyonu","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/sql-server-2016-openjson-fonksiyonu\/","title":{"rendered":"SQL Server 2016 &#8211; OpenJson Fonksiyonu"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Merhaba,<\/p>\n<p>\u015euana kadar SQL Server 2016 s\u00fcr\u00fcm\u00fcn\u00fcn bir\u00e7ok yap\u0131sal yenili\u011finden bahsetmi\u015f bulunmaktay\u0131z. Bu yap\u0131sal yeniliklerin yan\u0131nda farkl\u0131 fonksiyonellikler bar\u0131nd\u0131ran T-SQL metodlar\u0131 gelmi\u015f bulunmakta ve art\u0131k prosed\u00fcrel olarak gelen yeniliklere de\u011finmenin heyecan\u0131n\u0131 ya\u015famaktay\u0131z. \u00d6zellikle bir \u00f6nceki yaz\u0131m\u0131z olan <a href=\"http:\/\/www.gencayyildiz.com\/blog\/sql-server-2016-native-json\/\" target=\"_blank\">SQL Server 2016 \u2013 Native JSON<\/a> ba\u015fl\u0131kl\u0131 i\u00e7eri\u011fimizde ki yap\u0131sal yenilikten sonra bir dizi fonksiyonellikten bahsedece\u011fimizden bahsetmi\u015ftik. \u0130\u015fte bu i\u00e7eri\u011fimizde ilgili yaz\u0131n\u0131n getirisi olan yeni fonksiyonlardan biri olan OpenJson fonksiyonundan bahsediyor olaca\u011f\u0131z.<\/p>\n<p>OpenJson fonksiyonu sayesinde var olan bir JSON verisi \u00fczerinde sorgulama ger\u00e7ekle\u015ftirebilmekteyiz.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nSelect * from OPENJSON\r\n('\r\n{\r\n&quot;Adi&quot;: &quot;Gen\u00e7ay&quot;,\r\n&quot;SoyAdi&quot;: &quot;Y\u0131ld\u0131z&quot;,\r\n&quot;Ya\u015f&quot;: 3\r\n}\r\n')\r\n<\/pre>\n<p>Yukar\u0131daki \u00f6rnek kod blo\u011funu incelerseniz e\u011fer OpenJson fonksiyonuna verilmi\u015f bir JSON format\u0131ndaki veriyi sorgulamaktay\u0131z. Aslen burada yap\u0131lan i\u015flemin perde arkas\u0131ndan bahsetmemiz gerekirse e\u011fer OpenJson fonksiyonu, parametre olarak ald\u0131\u011f\u0131 JSON verisini arkada bir tabloya \u00e7evirmekte ve bizlere key\/value \u015feklinde a\u015fa\u011f\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnde oldu\u011fu gibi getirmektedir.<\/p>\n<p><a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2016\/11\/SQL-Server-2016-\u2013-OpenJson-Fonksiyonu.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5365\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2016\/11\/SQL-Server-2016-\u2013-OpenJson-Fonksiyonu.png\" alt=\"SQL Server 2016 \u2013 OpenJson Fonksiyonu\" width=\"179\" height=\"105\" \/><\/a><\/p>\n<p>Burada dikkat etmemiz gereken husus, OpenJson fonksiyonuna verilen de\u011ferin tam olarak JSON format\u0131nda olmas\u0131 gerekti\u011fidir. E\u011fer ki JSON format\u0131nda olmayan bir veri parametre olarak verilirse a\u015fa\u011f\u0131daki hata al\u0131nacakt\u0131r.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2016\/11\/SQL-Server-2016-\u2013-OpenJson-Fonksiyonu-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5368\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2016\/11\/SQL-Server-2016-\u2013-OpenJson-Fonksiyonu-1.png\" alt=\"SQL Server 2016 \u2013 OpenJson Fonksiyonu\" width=\"630\" height=\"202\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2016\/11\/SQL-Server-2016-\u2013-OpenJson-Fonksiyonu-1.png 630w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2016\/11\/SQL-Server-2016-\u2013-OpenJson-Fonksiyonu-1-300x96.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><br \/>\nBu hatan\u0131n metinsel halinide a\u015fa\u011f\u0131da payla\u015fmakta yarar var.<\/p>\n<blockquote><p><strong><em><span style=\"color: #ff0000;\">Msg 13609, Level 16, State 4, Line 1<\/span><\/em><\/strong><br \/>\n<strong><em><span style=\"color: #ff0000;\">JSON text is not properly formatted. Unexpected character &#8216;Y&#8217; is found at position 33.<\/span><\/em><\/strong><\/p><\/blockquote>\n<p>Lakin i\u015fin ilgin\u00e7 yan\u0131 hatay\u0131 ald\u0131\u011f\u0131m\u0131z yere kadar olan\u00a0veriler i\u015flenmi\u015f olacak ve &#8220;Results&#8221; k\u0131sm\u0131nda bu i\u015flenen yar\u0131m tablo a\u015fa\u011f\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnde oldu\u011fu gibi g\u00f6sterilecektir.<\/p>\n<p><a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2016\/11\/SQL-Server-2016-\u2013-OpenJson-Fonksiyonu-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5369\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2016\/11\/SQL-Server-2016-\u2013-OpenJson-Fonksiyonu-2.png\" alt=\"SQL Server 2016 \u2013 OpenJson Fonksiyonu\" width=\"163\" height=\"62\" \/><\/a><\/p>\n<p>Bu \u00f6zellik sayesinde JSON verinin yap\u0131sal olarak neresinde hata yahut bir eksiklik var h\u0131zl\u0131ca hesaplayabilir ve gerekli d\u00fczeltmeyi sa\u011flayabiliriz.<\/p>\n<p>Sonraki yaz\u0131lar\u0131mda g\u00f6r\u00fc\u015fmek \u00fczere&#8230;<\/p>\n<p>\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Merhaba, \u015euana kadar SQL Server 2016 s\u00fcr\u00fcm\u00fcn\u00fcn bir\u00e7ok yap\u0131sal yenili\u011finden bahsetmi\u015f bulunmaktay\u0131z. Bu yap\u0131sal yeniliklerin yan\u0131nda farkl\u0131 fonksiyonellikler bar\u0131nd\u0131ran T-SQL metodlar\u0131 gelmi\u015f bulunmakta ve art\u0131k prosed\u00fcrel olarak gelen yeniliklere de\u011finmenin heyecan\u0131n\u0131 ya\u015famaktay\u0131z. \u00d6zellikle bir&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":3415,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1412,22],"tags":[1549,245,1413,1539],"class_list":["post-5355","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql-server-2016","category-veritabani","tag-openjson","tag-sql-server","tag-sql-server-2016","tag-sql-server-2016-yenilikleri"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/5355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=5355"}],"version-history":[{"count":0,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/5355\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media\/3415"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=5355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=5355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=5355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}