JHarb52207
Programmer
Lets assume I have the following tables:
CUSTOMER:
ID CUSTOMER_NAME COMPANY
=====================================================================
1 Customer 1 1
2 Customer 2 1
3 Customer 3 1
4 Customer 4 2
5 Customer 5 2
6 Customer 6 2
7 Customer 7 1
8 Customer 8 2
9 Customer 9 2
10 Customer 10 2
USERS:
ID USER_NAME
=======================================
1 User 1
2 User 2
3 User 3
4 User 4
COMPANY:
ID COMPANY_NAME
==========================================
1 Company 1
2 Company 2
SECURITY:
USERID COMPANY_ID
========================================
1 1
1 2
2 1
3 2
4 1
4 2
Ok now I have an application that knows that if User 4 is pulling a list from the CUSTOMER table to show the customers for both companies. Likewise if User 2 preformed the same action they should only see customers from Company 1.
My question is how to I get this same functionality from say Query Analyzer? Can this be done with SQL or Windows users accounts, or can security be setup to pull from a table?
I would also like to know if there is a way to force this security through any ODBC that connected to this database.
CUSTOMER:
ID CUSTOMER_NAME COMPANY
=====================================================================
1 Customer 1 1
2 Customer 2 1
3 Customer 3 1
4 Customer 4 2
5 Customer 5 2
6 Customer 6 2
7 Customer 7 1
8 Customer 8 2
9 Customer 9 2
10 Customer 10 2
USERS:
ID USER_NAME
=======================================
1 User 1
2 User 2
3 User 3
4 User 4
COMPANY:
ID COMPANY_NAME
==========================================
1 Company 1
2 Company 2
SECURITY:
USERID COMPANY_ID
========================================
1 1
1 2
2 1
3 2
4 1
4 2
Ok now I have an application that knows that if User 4 is pulling a list from the CUSTOMER table to show the customers for both companies. Likewise if User 2 preformed the same action they should only see customers from Company 1.
My question is how to I get this same functionality from say Query Analyzer? Can this be done with SQL or Windows users accounts, or can security be setup to pull from a table?
I would also like to know if there is a way to force this security through any ODBC that connected to this database.