{"id":258,"date":"2009-02-08T15:47:00","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"http:\/\/www.yazilimmutfagi.com\/?p=258"},"modified":"2009-02-08T15:47:00","modified_gmt":"1970-01-01T00:00:00","slug":"sql-server-da-function-kullanimi","status":"publish","type":"post","link":"https:\/\/www.yazilimmutfagi.com\/index.php\/2009\/02\/08\/sql-server-da-function-kullanimi\/","title":{"rendered":"SQL Server da Function Kullanimi"},"content":{"rendered":"<p style=\"margin: 0cm 0cm 10pt; text-indent: 35.4pt;\" class=\"MsoNormal\"><span style=\"font-size: small; font-family: Calibri;\">Merhaba Arkadaslar,<\/span><\/p>\n<p style=\"margin: 0cm 0cm 10pt; text-indent: 35.4pt;\" class=\"MsoNormal\"><span style=\"font-size: small; font-family: Calibri;\">Bu makalemizde SQL Server da &ouml;nem arz eden, bazen gerekliligini iliklerinize kadar hissettiginiz kendi yazacagimiz SQL Functionlarini inceleyecegiz.<\/span><\/p>\n<p style=\"margin: 0cm 0cm 10pt;\" class=\"MsoNormal\"><span style=\"font-size: small; font-family: Calibri;\">Functionlar istenilen deger tipinde d&ouml;n&uuml;s yapabilir. INT, VARCHAR deger d&ouml;nd&uuml;rebileceginiz gibi bir tablo da d&ouml;nd&uuml;rebilirsiniz. Basit bir function ile &ouml;rnekleyelim konuyu.<\/span><\/p>\n<p style=\"margin: 0cm 0cm 10pt;\" class=\"MsoNormal\"><a href='www.yazilimmutfagi.com'>.<\/a><\/p>\n<p style=\"margin: 0cm 0cm 10pt; text-indent: 18pt;\" class=\"MsoNormal\"><span style=\"font-size: small; font-family: Calibri;\">Mesela MUSTERI tablosunda parametre olarak verdigimiz ID&rsquo;den ID&rsquo;si b&uuml;y&uuml;k esit olan m&uuml;sterilerden yasi en b&uuml;y&uuml;k olanin yasini d&ouml;nd&uuml;relim.<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"ListParagraph\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">CREATE<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">FUNCTION<\/span> udf_MusteriEnBuyukYas<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: gray; font-family: &quot;Courier New&quot;;\">(<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">@Id <span style=\"color: blue;\">int<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: green; font-family: &quot;Courier New&quot;;\">&#8212; alacagi parametreleri virg&uuml;l <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: green; font-family: &quot;Courier New&quot;;\">&#8211;ile ayirarak parametre birden cok parametre verebilirsiniz<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: gray; font-family: &quot;Courier New&quot;;\">)<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">RETURNS<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">int<\/span> <span style=\"color: green;\">&#8211;d&ouml;nd&uuml;recegi degerin tipi<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">AS<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">BEGIN<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"\">&nbsp; <\/span><span style=\"color: blue;\">DECLARE<\/span> @Result <span style=\"color: blue;\">int<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"\">&nbsp; <\/span><span style=\"color: blue;\">SET<\/span> @Result <span style=\"color: gray;\">=<\/span> <span style=\"color: gray;\">(<\/span><span style=\"color: blue;\">SELECT<\/span> <span style=\"color: fuchsia;\">Max<\/span><span style=\"color: gray;\">(<\/span>Yas<span style=\"color: gray;\">)<\/span> <span style=\"color: blue;\">FROM<\/span> MUSTERI <span style=\"color: blue;\">Where<\/span> Id <span style=\"color: gray;\">&gt;=<\/span>@Id<span style=\"color: gray;\">)<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">RETURN<\/span><span style=\"font-size: 10pt; color: gray; font-family: &quot;Courier New&quot;;\">(<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">@Result<span style=\"color: gray;\">)<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">END<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 10pt 18pt;\" class=\"MsoNormal\"><span style=\"font-size: small; font-family: Calibri;\">Peki, bunu nasil &ccedil;alistiracagiz. Hemen onun da kod &ouml;rnegini verelim.<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><a href=\"http:\/\/www.yazilimmutfagi.com\/Makale\/Img\/Osman\/11_1_resim1.jpg\"><img decoding=\"async\" loading=\"lazy\" height=\"105\" width=\"379\" alt=\"\" src=\"http:\/\/www.yazilimmutfagi.com\/Makale\/Img\/Osman\/11_1_resim1.jpg\" \/><\/a><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">DECLARE<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> @Id <span style=\"color: blue;\">int<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">SET<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> @Id <span style=\"color: gray;\">=<\/span> 2<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">SELECT<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> dbo<span style=\"color: gray;\">.<\/span>udf_MusteriEnBuyukYas<span style=\"color: gray;\">(<\/span>@Id<span style=\"color: gray;\">)<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: gray; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><img decoding=\"async\" loading=\"lazy\" height=\"74\" width=\"327\" alt=\"\" src=\"http:\/\/www.yazilimmutfagi.com\/Makale\/Img\/Osman\/11_1_resim2.jpg\" \/><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; line-height: normal;\" class=\"ListParagraphCxSpIlk\"><span style=\"font-size: small; font-family: Calibri;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt 18pt; text-indent: 17.4pt; line-height: normal;\" class=\"ListParagraphCxSpSon\"><span style=\"font-size: small;\"><span style=\"font-family: Calibri;\">&Ccedil;ok g&uuml;zel bir fonksiyon &ouml;rnegi ile konumuzu bitirelim. Bu fonksiyon bir tablo d&ouml;nd&uuml;rmektedir. Mesela DB den adinda &ldquo;Musteri&rdquo; nin ge&ccedil;tigi <span style=\"\">&nbsp;<\/span><span style=\"color: red;\">&#8216;Default or DEFAULT constraint&#8217; <\/span><\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: small;\"><span style=\"font-family: Calibri;\"><span style=\"color: red;\">&#8216;Scalar function&#8217; ,&#8217;Inlined table-function&#8217; ,&#8217;Stored procedure&#8217; ,&#8217;Rule&#8217;,&#8217;Replication filter stored procedure&#8217; ,&#8217;Table function&#8217; ,&#8217;Trigger&#8217; ,&#8217;User table&#8217; ,&#8217;View&#8217; ,&#8217;Extended stored procedure&#8217;<\/span> leri bulalim ve tipini de yazdiralim. Bunun i&ccedil;in asagidaki fonksiyonu olusturalim.<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><a href='www.yazilimmutfagi.com'>.<\/a><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">Create<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">Function<\/span> dbo<span style=\"color: gray;\">.<\/span>udf_FindObjects <span style=\"color: gray;\">(<\/span>@string <span style=\"color: blue;\">varchar<\/span><span style=\"color: gray;\">(<\/span>100<span style=\"color: gray;\">))<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">returns<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> @tbl<span style=\"\">&nbsp; <\/span><span style=\"color: blue;\">Table<\/span><span style=\"color: gray;\">(<\/span><span style=\"color: blue;\">Name<\/span> <span style=\"color: blue;\">varchar<\/span><span style=\"color: gray;\">(<\/span>128<span style=\"color: gray;\">),<\/span> <span style=\"color: blue;\">Type<\/span> <span style=\"color: blue;\">varchar<\/span><span style=\"color: gray;\">(<\/span>100<span style=\"color: gray;\">))<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">AS<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">BEGIN<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">insert<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">into<\/span> @tbl<span style=\"color: gray;\">(<\/span><span style=\"color: blue;\">Name<\/span><span style=\"color: gray;\">,<\/span><span style=\"color: blue;\">Type<\/span><span style=\"color: gray;\">)<\/span> <span style=\"color: blue;\">select<\/span> <span style=\"color: blue;\">name<\/span><span style=\"color: gray;\">,<\/span> ObjectType <span style=\"color: gray;\">=<\/span> <span style=\"color: blue;\">case<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;D&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;Default or DEFAULT constraint&#8217;<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;FN&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;Scalar function&#8217;<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;IF&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;Inlined table-function&#8217;<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;P&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;Stored procedure&#8217;<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;R&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;Rule&#8217;<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;RF&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;Replication filter stored procedure&#8217;<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;TF&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;Table function&#8217;<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;TR&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;Trigger&#8217;<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;U&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;User table&#8217;<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;V&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;View&#8217;<\/span> <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">when<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: blue;\">TYPE<\/span><span style=\"color: gray;\">=<\/span><span style=\"color: red;\">&#8216;X&#8217;<\/span> <span style=\"color: blue;\">then<\/span> <span style=\"color: red;\">&#8216;Extended stored procedure&#8217;<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">else<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: red;\">&#8216;others&#8217;<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">end<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><span style=\"\">&nbsp;<\/span><span style=\"color: blue;\">from<\/span> sysobjects <span style=\"color: blue;\">where<\/span> id <span style=\"color: gray;\">in<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: gray; font-family: &quot;Courier New&quot;;\">(<\/span><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">select<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> id <span style=\"color: blue;\">from<\/span> syscomments <span style=\"color: blue;\">where<\/span> <span style=\"color: blue;\">text<\/span> <span style=\"color: gray;\">like<\/span> <span style=\"color: red;\">&#8216;%&#8217;<\/span><span style=\"color: gray;\">+<\/span>@string<span style=\"color: gray;\">+<\/span><span style=\"color: red;\">&#8216;%&#8217;<\/span><span style=\"color: gray;\">)<\/span><\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">return<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; text-indent: 18pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">END<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&Ouml;rnek sorgu olarak da <\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; color: blue; font-family: &quot;Courier New&quot;;\">SELECT<\/span><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"> <span style=\"color: gray;\">*<\/span> <span style=\"color: blue;\">FROM<\/span> dbo<span style=\"color: gray;\">.<\/span>udf_FindObjects<span style=\"color: gray;\">(<\/span><span style=\"color: red;\">&#8216;musteri&#8217;<\/span><span style=\"color: gray;\">) <\/span><\/span><span style=\"font-size: small; font-family: Calibri;\">&ccedil;alistirdigimiz da asagidaki sonucu aliriz.<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\">&nbsp;<\/span><\/p>\n<p style=\"margin: 0cm 0cm 0pt; line-height: normal;\" class=\"MsoNormal\"><span style=\"font-size: 10pt; font-family: &quot;Courier New&quot;;\"><img decoding=\"async\" loading=\"lazy\" height=\"121\" width=\"349\" alt=\"\" src=\"http:\/\/www.yazilimmutfagi.com\/Makale\/Img\/Osman\/11_1_resim3.jpg\" \/><\/span><\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Bu makalemizde Sql Serverda &#246;nem arz eden bazen gerekliligini iliklerinize kadar hissettiginiz kendi yazacagimiz SQL Functionlarini inceleyecegiz.<\/p>\n","protected":false},"author":550,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[422],"tags":[5294,4960,4555,3877],"_links":{"self":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts\/258"}],"collection":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/users\/550"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/comments?post=258"}],"version-history":[{"count":0,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts\/258\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/media?parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/categories?post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/tags?post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}