Hi,
is there a way to raise an error if a user run a SELECT statement which contains specific keywords?
here my scenario:
I want to insure that if a user open a connection to a specific database and try to execute a select statement which access another specific database, then raise an error.
example:
connection to the DB1 database, query= Select * from DB2.dbo.Table, then raise an error
connection to the DB1 database, query= Select * from DB3.dbo.Table, then NO error (this DB3 access from DB1 is permitted)
The user has access to the DB1 and the DB2 databases, I want to insure that 2 databases are never used in cross database queries.
is it possible to filter this in SQL Server? (using database triggers, server triggers or session event?)
thanks.