Introduction:

Here I will explain SQL server Inline table valued function example or create Inline table valued function example in SQL server . Inline table valued Functions in SQL server is used to accept input parameters and it will return table.


Description:

The inline table valued function are similar to multi-statement table valued function. inline function return a table. the inline function consists of only a single select statement query. Inline functions can be used to achieve the functionality of parameterized views. Views do not support parameters in the search conditions specified in the WHERE clause. Inline functions can be used to support parameters in the search conditions specified in the WHERE clause.  When we need to get records with search conditions in that case we can be use inline function. 

Create inline table valued function :


CREATE FUNCTION dbo.GetStudent(@name nvarchar(100))
RETURNS table
AS
RETURN
(
SELECT * from student where Name like '%'+@name+'%'
)


Here we are going to call SQL Server function shown below:

 

select * from dbo.GetStudent('a')

OutPut

Thanks.

0 comments


Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

Welcome to SQL Tutorials Point

Don't have an account? Click here to Create a new account, it takes less than a minute.