Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can we have a TVF call inside a Scalar function ?

Status
Not open for further replies.

cheenujunk

Programmer
Jul 22, 2010
2
US
I am using the following query

select 'level' =

case when dbo.function1 = 1 then

( case when ( dbo.function2(dbo.function3, 1) > 0) then 3

end )

end

it is showing error "Cannot find either column "dbo" or the user-defined function or aggregate dbo.function3 "

dbo.function3 is TVF.

so i tried with this

select 'level' =

case when dbo.function1 = 1 then

( case when ( dbo.function2((select * from dbo.function3), 1) > 0) then 3

end )

end

then i have

"Only one expression can be specified in the select list when the subquery is not introduced with EXISTS."

ONLY function3 is TVF all others are scalar.

Let me know whats the right way to code this.
 
The TVF function creates a table of list of ppl based on a particular program.

Then the function2 checks for these ppl in the list, whether they are above certain age or not.

These two are put in different functions, since both of them are used elsewhere too.

Is the info enough or u need some more regarding each table and func. ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top