Hi,
Is there ANY way to create an inline table function that impersonates someone else?
More Details:
Specifically, I want to create a table "TableA" that a user does NOT have permission to see/modify in any way. Then, I want to create a function called FunctionA along the lines of this:
CREATE FUNCTION FunctionA()
RETURNS TABLE
WITH EXECUTE AS N'dbo'
AS
RETURN (SELECT * FROM TableA where TableA.UserName = user_name())
GO
This would create a function that I could use JUST like a table, but which would only let me see/modify/delete the records that were associated with MY username. All other data would be filtered out by the function and since my username would NOT have access to the table directly - I would have secure access to my data only. Does that make any sense?
Anyway - I've been going around and around with INLINE TABLE functions (which don't seem to allow WITH EXECUTE AS) and MULTILINE table functions which don't seem to allow INSERT INTO in the way that INLINE TABLE functions do.
Any suggestions?
Thanks.
EJ
Start Free Trial