A web application data controller can define sophisticated SQL Business Rules that are automatically engaged during the lifecycle of an application. The rules are written in the SQL dialect supported by the database engine (T-SQL, PL-SQL, etc).
SQL Business Rules can interact with the database tier, application server tier, and client web browser tier of a web app.
If you know SQL, then you are already an expert in creating SQL Business Rules.
This is the example of SQL Business Rule performing validation written in T/SQL (Microsoft SQL Server).
-- validate the data field value
if @Country = 'USA'
begin
-- tell the application server to skip the execution of update, insert, or delete
set @BusinessRules_PreventDefault = 1
-- set the focus to the field "Country" and display an error message
set @Result_Focus =
'Country, You are not authorized to ' + lower(@Arguments_CommandName) +
', if the Country is equal to "USA".'
-- show an additional information in the message bar at the top of the page
set @Result_ShowMessage =
'Error trying to execute ' + @Arguments_CommandName + ' command.'
end
The screenshot demonstrates the business rule in action.
Take a look at the other example of SQL Business Rules.