{"id":1732,"date":"2021-12-19T12:18:39","date_gmt":"2021-12-19T07:18:39","guid":{"rendered":"https:\/\/www.hawkerstreetfood.com\/?p=1732"},"modified":"2021-12-29T12:24:22","modified_gmt":"2021-12-29T07:24:22","slug":"how-to-execute-function-in-sql-server","status":"publish","type":"post","link":"https:\/\/www.hawkerstreetfood.com\/index.php\/2021\/12\/19\/how-to-execute-function-in-sql-server\/","title":{"rendered":"How to execute function in SQL Server"},"content":{"rendered":"<p>I built a function and I am trying to execute it&#8230; but some errors are occurring<\/p>\n<pre class=\"lang-sql s-code-block\"><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">FUNCTION<\/span> dbo.Afisho_rankimin\r\n(\r\n    <span class=\"hljs-variable\">@emri<\/span>_rest <span class=\"hljs-type\">int<\/span>\r\n)\r\n<span class=\"hljs-keyword\">RETURNS<\/span> <span class=\"hljs-type\">int<\/span>\r\n<span class=\"hljs-keyword\">AS<\/span>\r\n<span class=\"hljs-keyword\">BEGIN<\/span>\r\n    <span class=\"hljs-keyword\">Declare<\/span> <span class=\"hljs-variable\">@rankimi<\/span> <span class=\"hljs-type\">int<\/span>\r\n\r\n    <span class=\"hljs-keyword\">Select<\/span> <span class=\"hljs-variable\">@rankimi<\/span> <span class=\"hljs-operator\">=<\/span> dbo.RESTORANTET.Rankimi\r\n    <span class=\"hljs-keyword\">From<\/span> RESTORANTET\r\n    <span class=\"hljs-keyword\">Where<\/span> dbo.RESTORANTET.ID_Rest <span class=\"hljs-operator\">=<\/span> <span class=\"hljs-variable\">@emri<\/span>_rest\r\n\r\n    <span class=\"hljs-keyword\">RETURN<\/span> <span class=\"hljs-variable\">@rankimi<\/span>\r\n<span class=\"hljs-keyword\">END<\/span>\r\nGO\r\n\r\n<span class=\"hljs-keyword\">SELECT<\/span> dbo.Afisho_rankimin(<span class=\"hljs-number\">5<\/span>) <span class=\"hljs-keyword\">AS<\/span> Rankimi\r\nGO<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I built a function and I am trying to execute it&#8230; but some errors are<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[42],"tags":[12604,12605,12606],"class_list":["post-1732","post","type-post","status-publish","format-standard","hentry","category-more","tag-sql","tag-sql-server","tag-tsql"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hawkerstreetfood.com\/index.php\/wp-json\/wp\/v2\/posts\/1732","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hawkerstreetfood.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hawkerstreetfood.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hawkerstreetfood.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hawkerstreetfood.com\/index.php\/wp-json\/wp\/v2\/comments?post=1732"}],"version-history":[{"count":1,"href":"https:\/\/www.hawkerstreetfood.com\/index.php\/wp-json\/wp\/v2\/posts\/1732\/revisions"}],"predecessor-version":[{"id":1733,"href":"https:\/\/www.hawkerstreetfood.com\/index.php\/wp-json\/wp\/v2\/posts\/1732\/revisions\/1733"}],"wp:attachment":[{"href":"https:\/\/www.hawkerstreetfood.com\/index.php\/wp-json\/wp\/v2\/media?parent=1732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hawkerstreetfood.com\/index.php\/wp-json\/wp\/v2\/categories?post=1732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hawkerstreetfood.com\/index.php\/wp-json\/wp\/v2\/tags?post=1732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}