{"id":6867,"date":"2024-02-28T05:54:00","date_gmt":"2024-02-28T04:54:00","guid":{"rendered":"https:\/\/expert-only.com\/?p=6867"},"modified":"2024-03-15T12:19:18","modified_gmt":"2024-03-15T11:19:18","slug":"how-to-call-sql-server-function","status":"publish","type":"post","link":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/","title":{"rendered":"How to Call a SQL Server Function using T-SQL ?"},"content":{"rendered":"\n<p><strong>How to call SQL Server functions from Transact-SQL scripts? Tutorial on how to call a SQL Server function using T-SQL scripts, with and without parameters. Indeed, the T-SQL syntax for calling a function is different from calling a stored procedure.<\/strong><\/p>\n\n\n\n<p>Use the SQL Server function in the same way you select data from a table. Learning how to call a user-defined SQL Server function with a T-SQL script is essential for optimizing the maintenance of your database and make data manipulation easier.<\/p>\n\n\n\n<p>In this SQL tutorial, we will examine how to use a user-defined function and how to customize the output of the function to meet specific needs. A <a href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-create-a-sql-server-function\/\"><strong>user-defined SQL Server function<\/strong><\/a> is a Transact-SQL program that accepts input parameters. When called, it performs actions, such as reading a SQL Server table, and returns an output result.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#1-input-parameter-is-not-mandatory-in-a-sql-server-function\" >1. Input parameter is not mandatory in a SQL Server function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#2-the-output-result-is-mandatory-in-t-sql-functions\" >2. The output result is mandatory in T-SQL functions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#3-call-a-sql-server-function-and-rename-the-output-column\" >3. Call a SQL Server function and rename the output column<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-input-parameter-is-not-mandatory-in-a-sql-server-function\"><span class=\"ez-toc-section\" id=\"1-input-parameter-is-not-mandatory-in-a-sql-server-function\"><\/span>1. Input parameter is not mandatory in a SQL Server function<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>A function does not necessarily have an input parameter. However, a user-defined SQL Server function <a href=\"https:\/\/opac.imist.ma\/cgi-bin\/koha\/opac-detail.pl?biblionumber=39629\" target=\"_blank\" rel=\"noreferrer noopener\">returns data<\/a>, which can be an empty result set, a single row, or multiple columns. For example, let&#8217;s call the function created in this tutorial to create an MS SQL function with a script. For example, if you call the built-in function to display the date in SQL Server, the system returns the current date.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT GETDATE();\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-2-the-output-result-is-mandatory-in-t-sql-functions\"><span class=\"ez-toc-section\" id=\"2-the-output-result-is-mandatory-in-t-sql-functions\"><\/span>2. The output result is mandatory in T-SQL functions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Indeed, a function is defined by the fact that it returns a result. To call a function, open SSMS and adapt the function code if necessary. Consider this script to create a function called dbo.ufnDisplayCustomers in T-SQL:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CREATE FUNCTION dbo.ufnDisplayCustomers(@CustomerID INTEGER)\nRETURNS NVARCHAR(20)\nAS \nBEGIN \n  DECLARE @CustomerName  AS NVARCHAR(20);\n  SELECT  @CustomerName = [Name]\n  FROM    [dbo].[Customers]\n  WHERE   [CustomerID] = @CustomerID;\n  RETURN  @CustomerName;\nEND\nGO\n<\/pre>\n\n\n\n<p>To call a SQL Server function, use the following syntax:<\/p>\n\n\n\n<p><em><strong>SELECT dbo.FunctionName(Parameters);<\/strong><\/em><\/p>\n\n\n\n<p>The function below displays the name of a customer associated with the customer number passed as a parameter. Of course we assume that you have a table with at least these two columns, like in the example.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>CustomerID<\/li>\n\n\n\n<li>Name<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/* Expert-Only.com *\/ \nSELECT [CustomerID]\n      ,[Name]\n  FROM [Expert-Only].[dbo].[Customers];\n\n\n\/* Expert-Only.com *\/ \nSELECT dbo.ufnDisplayCustomers(1);\n<\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"580\" src=\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/07\/sql-server-function-from-t-sql-query.jpg\" alt=\"Query example to call a SQL Server Function from T-SQL\" class=\"wp-image-30356\" srcset=\"https:\/\/expert-only.com\/wp-content\/uploads\/2023\/07\/sql-server-function-from-t-sql-query.jpg 640w, https:\/\/expert-only.com\/wp-content\/uploads\/2023\/07\/sql-server-function-from-t-sql-query-300x272.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><figcaption class=\"wp-element-caption\"><em>Query example to call a SQL Server Function from T-SQL<\/em><\/figcaption><\/figure><\/div>\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"bzRmDcm1PK\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-create-a-sql-server-function\/\">How to create a SQL Server function with a script ?<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;How to create a SQL Server function with a script ?&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-create-a-sql-server-function\/embed\/#?secret=7hIaqeNpaH#?secret=bzRmDcm1PK\" data-secret=\"bzRmDcm1PK\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-3-call-a-sql-server-function-and-rename-the-output-column\"><span class=\"ez-toc-section\" id=\"3-call-a-sql-server-function-and-rename-the-output-column\"><\/span>3. Call a SQL Server function and rename the output column<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>With this second call example, we can also rename the result column to customize the output. To do this, use the generic syntax below:<\/p>\n\n\n\n<p><em><strong>SELECT dbo.FunctionName(Parameters) AS [NewColumnName];<\/strong><\/em><\/p>\n\n\n\n<p>Below is a practical example, using Customers data, so the function is used to display the customers name based on the customer ID, then the result column is renamed as <em>CustomerName<\/em>, the same way columns are renamed in SQL Server SELECT queries. <\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"mssql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SELECT dbo.ufnDisplayCustomers(1) AS [CustomerName]; \n<\/pre>\n\n\n\n<p>In this other tutorial, we explain <a href=\"https:\/\/expert-only.com\/en\/t-sql\/modify-sql-server-function\/\"><strong>how to modify an existing SQL Server function<\/strong><\/a>. For more in-depth and official information on SQL Server user functions, read the MS <a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/relational-databases\/user-defined-functions\/user-defined-functions?view=sql-server-2017\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">documentation<\/a> directly on the Microsoft website.<\/p>\n\n\n\n<p>The English documentation is generally richer and more complete than in other languages, including French. The official Microsoft forum on databases and English support pages are also much more active than other languages.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-about-calling-sql-server-functions-from-t-sql-scripts\">About calling SQL Server functions from T-SQL scripts<\/h3>\n\n\n\n<p>In conclusion, we saw how to call a SQL Server function from a T-SQL script, it is a necessary operation to optimize and especially reuse code efficiently in your database. This tutorial has shown you how to create, call, and customize SQL Server functions.<\/p>\n\n\n\n<p>By mastering these techniques, you will be able to get the most out of your SQL Server database and significantly improve the performance of your applications.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-wp-embed is-provider-sql-and-it-tutorials wp-block-embed-sql-and-it-tutorials\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"Z1uOlrZ0js\"><a href=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-user-defined-functions\/\">Manage SQL Server user defined functions<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Manage SQL Server user defined functions&#8221; &#8212; SQL and IT Tutorials\" src=\"https:\/\/expert-only.com\/en\/t-sql\/manage-sql-server-user-defined-functions\/embed\/#?secret=xHf6FgtiP3#?secret=Z1uOlrZ0js\" data-secret=\"Z1uOlrZ0js\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>How to call SQL Server functions from Transact-SQL scripts? Tutorial on how to call a SQL Server function using T-SQL scripts, with and without parameters. Indeed, the T-SQL syntax for calling a function is different from calling a stored <a class=\"mh-excerpt-more\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/\" title=\"How to Call a SQL Server Function using T-SQL ?\">&#8230;<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":5811,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[454],"tags":[],"class_list":{"0":"post-6867","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-t-sql"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.7 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Call a SQL Server Function using T-SQL ? Expert-Only<\/title>\n<meta name=\"description\" content=\"To call a SQL Server function from a T-SQL script, display the data returned by the function using a Select query and optional parameters.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Call a SQL Server Function using T-SQL ?\" \/>\n<meta property=\"og:description\" content=\"To call a SQL Server function from a T-SQL script, display the data returned by the function using a Select query and optional parameters.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL and IT Tutorials\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-28T04:54:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-15T11:19:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/inspiration_dark_new-york-city-F323EDDD185_1920x1080.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Expert-Only\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@expert_only\" \/>\n<meta name=\"twitter:site\" content=\"@expert_only\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Expert-Only\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/\"},\"author\":{\"name\":\"Expert-Only\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\"},\"headline\":\"How to Call a SQL Server Function using T-SQL ?\",\"datePublished\":\"2024-02-28T04:54:00+00:00\",\"dateModified\":\"2024-03-15T11:19:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/\"},\"wordCount\":576,\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/inspiration_dark_new-york-city-F323EDDD185_1920x1080.jpeg\",\"articleSection\":[\"T-SQL\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/\",\"url\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/\",\"name\":\"How to Call a SQL Server Function using T-SQL ? Expert-Only\",\"isPartOf\":{\"@id\":\"https:\/\/expert-only.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/inspiration_dark_new-york-city-F323EDDD185_1920x1080.jpeg\",\"datePublished\":\"2024-02-28T04:54:00+00:00\",\"dateModified\":\"2024-03-15T11:19:18+00:00\",\"description\":\"To call a SQL Server function from a T-SQL script, display the data returned by the function using a Select query and optional parameters.\",\"breadcrumb\":{\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#primaryimage\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/inspiration_dark_new-york-city-F323EDDD185_1920x1080.jpeg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/inspiration_dark_new-york-city-F323EDDD185_1920x1080.jpeg\",\"width\":1920,\"height\":1080},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"en\",\"item\":\"https:\/\/expert-only.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Call a SQL Server Function using T-SQL ?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/expert-only.com\/en\/#website\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"name\":\"SQL and IT Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/expert-only.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/expert-only.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/expert-only.com\/en\/#organization\",\"name\":\"Expert-Only\",\"url\":\"https:\/\/expert-only.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"contentUrl\":\"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg\",\"width\":381,\"height\":174,\"caption\":\"Expert-Only\"},\"image\":{\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/ExpertOnlyCom\/\",\"https:\/\/x.com\/expert_only\",\"https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef\",\"name\":\"Expert-Only\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g\",\"caption\":\"Expert-Only\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Call a SQL Server Function using T-SQL ? Expert-Only","description":"To call a SQL Server function from a T-SQL script, display the data returned by the function using a Select query and optional parameters.","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:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/","og_locale":"en_US","og_type":"article","og_title":"How to Call a SQL Server Function using T-SQL ?","og_description":"To call a SQL Server function from a T-SQL script, display the data returned by the function using a Select query and optional parameters.","og_url":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/","og_site_name":"SQL and IT Tutorials","article_publisher":"https:\/\/www.facebook.com\/ExpertOnlyCom\/","article_published_time":"2024-02-28T04:54:00+00:00","article_modified_time":"2024-03-15T11:19:18+00:00","og_image":[{"width":1920,"height":1080,"url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/inspiration_dark_new-york-city-F323EDDD185_1920x1080.jpeg","type":"image\/jpeg"}],"author":"Expert-Only","twitter_card":"summary_large_image","twitter_creator":"@expert_only","twitter_site":"@expert_only","twitter_misc":{"Written by":"Expert-Only","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#article","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/"},"author":{"name":"Expert-Only","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef"},"headline":"How to Call a SQL Server Function using T-SQL ?","datePublished":"2024-02-28T04:54:00+00:00","dateModified":"2024-03-15T11:19:18+00:00","mainEntityOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/"},"wordCount":576,"publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/inspiration_dark_new-york-city-F323EDDD185_1920x1080.jpeg","articleSection":["T-SQL"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/","url":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/","name":"How to Call a SQL Server Function using T-SQL ? Expert-Only","isPartOf":{"@id":"https:\/\/expert-only.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#primaryimage"},"image":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#primaryimage"},"thumbnailUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/inspiration_dark_new-york-city-F323EDDD185_1920x1080.jpeg","datePublished":"2024-02-28T04:54:00+00:00","dateModified":"2024-03-15T11:19:18+00:00","description":"To call a SQL Server function from a T-SQL script, display the data returned by the function using a Select query and optional parameters.","breadcrumb":{"@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#primaryimage","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/inspiration_dark_new-york-city-F323EDDD185_1920x1080.jpeg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/08\/inspiration_dark_new-york-city-F323EDDD185_1920x1080.jpeg","width":1920,"height":1080},{"@type":"BreadcrumbList","@id":"https:\/\/expert-only.com\/en\/t-sql\/how-to-call-sql-server-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"en","item":"https:\/\/expert-only.com\/en\/"},{"@type":"ListItem","position":2,"name":"How to Call a SQL Server Function using T-SQL ?"}]},{"@type":"WebSite","@id":"https:\/\/expert-only.com\/en\/#website","url":"https:\/\/expert-only.com\/en\/","name":"SQL and IT Tutorials","description":"","publisher":{"@id":"https:\/\/expert-only.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/expert-only.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/expert-only.com\/en\/#organization","name":"Expert-Only","url":"https:\/\/expert-only.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","contentUrl":"https:\/\/expert-only.com\/wp-content\/uploads\/2017\/09\/cropped-logo_Expert-Only.jpg","width":381,"height":174,"caption":"Expert-Only"},"image":{"@id":"https:\/\/expert-only.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ExpertOnlyCom\/","https:\/\/x.com\/expert_only","https:\/\/www.youtube.com\/channel\/UCMS5sR_FwAetB0FmciNvUaA"]},{"@type":"Person","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/406a9576b52944f018739a42046873ef","name":"Expert-Only","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/expert-only.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/084b15660763ff5b13bb60b2f52f97bb?s=96&d=identicon&r=g","caption":"Expert-Only"}}]}},"_links":{"self":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/6867","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/comments?post=6867"}],"version-history":[{"count":12,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/6867\/revisions"}],"predecessor-version":[{"id":30730,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/posts\/6867\/revisions\/30730"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media\/5811"}],"wp:attachment":[{"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/media?parent=6867"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/categories?post=6867"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/expert-only.com\/en\/wp-json\/wp\/v2\/tags?post=6867"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}