Hi Oliver,
Views do not take parameters, but stored procedures accept parameters. In your case, Views will not be the right solution. Stored Procedures should be what you are looking for.
Revoke all permission for that db user on that database.
Code:
Revoke all from testaccount
Then create a stored proc that accepts parameter and code it the way you want and grant execute permission for that user on the procedure, not on the table.
Code:
Grant Execute on PROC_NAME to testaccount
Now, login as that user and try
Code:
Select * from ANY_TABLENAME_In_That_DB
that results in error
Server: Msg 229, Level 14, State 5, Line 1
SELECT permission denied on object 'TABLENAME', database 'DB_NAME', owner 'dbo'.
The testaccount user is now allowed to execute the PROC, which works fine, but cannot play around with data/table there. Still [code]
Sp_helptext PROC_NAME would show the code to the user. But that is harmless. That user can now do nothing with that.
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection