Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sql server 2012 - can't grant on select on multi-statement table-valued function

It's my first question here, so I say: hallo!

I have a multi-statement table-valued function (called fn) which (of course) returns a table. I also created a database role (called dbr).

I tried to add permission my dbr can select from my fn.

So I opened the dbr, add my fn to securables, grant on Select and I get an error: Key cannot be null. Parameter name: key (mscorelib)

This is little strange, cause in my fn I have primary key on return-table-variable and also key cannot be null. To be specific key is build with three fields: dateFrom, dateTo, article

Function works perfectly, but I cannot make it available to my dbr members.

Any sugestions?

like image 948
mtz Avatar asked Aug 03 '26 02:08

mtz


1 Answers

May be it's a bug of non-patched Management Studio or you click in a wrong place, why don't you use T-SQL instead?

grant select on dbo.fn to dbr
like image 125
sepupic Avatar answered Aug 04 '26 20:08

sepupic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!