Hi,
I logged in as a sysadmin and created a tabled valued function to get database sizes as under-:
CREATE FUNCTION [dbo].[get_database_Sizes] ( @Type_Of_Db varchar(10))
RETURNS TABLE
AS
RETURN
(
SELECT DB_NAME(database_id) AS DatabaseName,(size*8)/1024 as SizeInMB,getdate() as Date_of_Trn FROM sys.master_files where type_desc = @Type_Of_Db
)
I created a login LimitedUser and added the login to the master
For the user I assigned previliges as follows-:
use [master]
GO
GRANT CONTROL ON [dbo].[get_database_Sizes] TO [UserLimited]
GO
use [master]
GO
GRANT REFERENCES ON [dbo].[get_database_Sizes] TO [UserLimited]
GO
use [master]
GO
GRANT SELECT ON [dbo].[get_database_Sizes] TO [UserLimited]
GO
use [master]
GO
GRANT SELECT ON [sys].[master_files] TO [UserLimited]
GO
Then I logged in as LimitedUser and issued the command as follows-:
select * from dbo.get_database_Sizes('Rows')
No Rows were returned.
However when I assign the db_owner role to the user rows are returned when I issue the select * from dbo.get_database_Sizes('Rows') command.
My intention is just to assign the select prevelige to the user and retreive the rows from the tabled valued function.
How can I acheive it?
Thanking you in anticipation.
Binny Mathew