开发者

How to block certain SQL queries to be executed on the SQL Server 2008

I have a database in SQL Server 2008 R2 Standard Edition.

I want to block certain query to be blocked directly on the server itself. So that no matter what a user executed i want block it and return just a specified result.

For eg: If a user is executing a query either from the application or from managem开发者_如何学JAVAent studio like. "select * from members"

Now on SQL Server no sooner this query is received it should simply not execute it and return the output with 0 records.

This is a very application specific requirement where i do not have control on applicate code otherwise i would have changed it in application level itself.

Please help


You can't block a query in the manner you have described. You would need an instead of select trigger. These don't exist.

You could perhaps rename the table members and then create a view called members instead though?


Is this a query that you are trying to block? Or are you trying to block SELECT access to certain tables?

DENY SELECT ON members TO Public;

Will keep people from reading the [members] table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜