INF: Providing Application Security Through Triggers in SQLID: Q66678
|
This articles discusses how a form of application security can be achieved without hard-coding user names and passwords into an application. This allows people to use many different front-ends to view the information, but allows data modification to be done only from specified applications.
Using triggers and SQL Server system functions, it is relatively easy
to provide this type of application security. The following example
illustrates one of the ways you can implement application-level
security:
CREATE TRIGGER trigname
ON tblname
FOR UPDATE, INSERT, DELETE
AS
IF (SELECT DISTINCT(program_name)
FROM master..sysprocess
WHERE hostprocess = HOST_ID()) != "app_name"
BEGIN
RAISEERROR 3000 "Table may only be modified by app_name"
END
Additional query words: Transact-SQL triggers
Keywords : kbusage SSrvServer
Version : 4.2
Platform : OS/2
Issue type :
Last Reviewed: March 10, 1999