Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call table valued function inside select Statement?

Tags:

sql

asp.net

I have created table valued function. I am calling like this

select * from dbo.fun_sample(1)

It is working fine. I have table called Emp

Table Emp

Id Name Lname
1  Rani Kale

My select Statement is like this

Select id,Name,Lname from Emp

By passing value of id to function ,I want fetch table(having 2 column).But is not working

Select id,Name,Lname,(select * from dbo.fun_sample(1)) from Emp
like image 347
Jui Test Avatar asked Nov 28 '14 05:11

Jui Test


1 Answers

use CROSS APPLY

Select e.id,e.Name,e.Lname from Emp e
CROSS APPLY dbo.fun_sample(1)
like image 125
Codeek Avatar answered Sep 24 '22 22:09

Codeek