Re: SQL7 Column-level constraints/filters possible?

From: Steve Hendricks (anonymous@devdex.com)
Date: 09/19/02


From:     Steve Hendricks <anonymous@devdex.com>
Date: Wed, 18 Sep 2002 16:39:42 -0700


Jeffery,

Here's the sad news... There is not a native way to filter the data
based on the login. While the SQL server can determine the User logged
on, a trigger can only be applied to Inserts, Updates and Deletes; not
Selects.

A set of views could be developed but there would need to be one for
each table that held company specific data and the application would
need to be modified in each location in the code where one of these
tables is accessed. Further, the triggers would not be very efficient
since they would need to reference the User and at least one other table
that correlated the user to the appropriate company.

I am working with a third party application that also uses a CompanyID
value in most of the tables to distinquish data from different
companies. When you log into the application, you define the "current
company". All of the SQL scripts make use of this current company value
when retrieving data (e.g., SELECT blah, blah FROM MyTable WHERE
CompanyID = 'XYZ' and blah, blah, blah...)

You have my condolences...

Steve Hendricks, MCSD, MCDBA
shendricks@afsconsulting.com
(949) 588-9800 x15

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: Views vs Stored Procedures, whats the difference?
    ... @optional_parm1 int = NULL, ... select max(blah) ... from yourquery ... Keep in mind that SQL Server employs parameter sniffing, ...
    (comp.databases.ms-sqlserver)
  • Re: Revoke/deny SOX issue
    ... Jasper Smith (SQL Server MVP) ... > I tried to deny all rights to my username, ... > was still able create insert, update, blah, blah... ... > REVOKE ALL ON testrights TO jfischer ...
    (microsoft.public.sqlserver.security)
  • Re: Linked Server to Excel Issue
    ... Your proxy account does not have access to network resources. ... -- -oj "Raul" wrote in message ... >I am using a linked server to connect SQL Server to an Excel Spreadsheet on> the network. ... I keep getting the dreaded "error 7399: blah, blah,> blah". ...
    (microsoft.public.sqlserver.programming)
  • Linked Server to Excel Issue
    ... I am using a linked server to connect SQL Server to an Excel Spreadsheet on ... Enterprise Manager) and try to run a query using the OPENQUERY and linked ... I keep getting the dreaded "error 7399: blah, blah, ...
    (microsoft.public.sqlserver.programming)
  • Re: Getting a Distinct Count from Crystal
    ... I have a database with visitors to a center. ... Although they login in one ... stamp on the visitor table, then selecting onling those equal to "1", but ... select person, blah, blah, ...
    (microsoft.public.vb.crystal)