Q: My MicrosoftAccess2000 application writes data from the backend SQLServer2000 database. To prevent Access users from seeing all the data in the SQLServer2000 table, I want to use a view that only allows users to browse authorized data rows. Can I create a view that limits user access to SQL Server data? A: Yes. If each user asks only: my Microsoft Access 2000 application writes data from the back-end SQL Server 2000 database. To prevent Access users from seeing all the data in SQL Server 2000, I want to use a view that only allows users to browse authorized data rows. Can I create a view that limits user access to SQL Server data?
A: Yes. If each user logs on to Access using a unique user ID, you can create a view that limits user Access to SQL Server data. The following example creates a view:
Create view v_data
SELECT
FROM dbo. mytable AS
Inner join dbo. authtable AS B
ON (a. Pkey = B. DataKey
AND B. userid = suser_sname ())
This view limits user access by userid. It requires you to save a table (authtable) with the username that matches the specific primary key in the data table (mytable ). If your situation is relatively simple-you do not need to manage row access permissions for multiple users, you can insert the userid column into the data table, as shown in the following code:
Create view v_data
SELECT
FROM dbo. mytable AS
WHERE a. userid = suser_sname ()
-Microsoft SQL Server Development team