0

I'm getting syntax error when trying to execute table valued function.

select * from fn_security(select R.rk from dbo.LINK R)

Error:

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'select'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ')'.

What am I doing wrong? how to execute this?

1 Answer 1

2

You can't pass whole table,like the way,you are trying now..you can use cross apply to get all

you can try below

select * from dbo.LINK  r
cross apply
dbo. fn_security(r.rk)
Sign up to request clarification or add additional context in comments.

6 Comments

So, that means, 'cross apply' will give the same result if "fn_security" would have a table instead of function? That is , for example, select * from table_security(select R.rk from dbo.LINK R) is same as [in terms of getting results] select * from dbo.LINK r cross apply dbo. fn_security(r.rk)
You can't pass whole table - what about user-defined table types? You can use cross apply - what about outer apply?
Think of cross apply as join,but you can reference the main table columns ,so if your join yields multiple results,then multiple values
@TryingBest - you're the person who has both the table LINK and the function table_security. We don't. You at least can try the query and see what it produces. If it doesn't produce what you expect, then I'd suggest editing your question and including sample data and expected results
@gotqn: i am not sure ,i understand totally what about outer apply? ,user defined table types can be used for procedues only
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.