Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL user/login problem

Author  Topic 

tomino79
Starting Member

13 Posts

Posted - 2005-06-17 : 08:34:30
Hi, I have only a database admin account on my database on the SQL Server. But I need to create users because I want to create modified views (
for example Max has a view of customers from eastern part of country and
Julia has a view of customers from western part of country )

but the view should have the same name. So the application shows customers from west when Julia logs on and show customers from east whe Max is logged on.

I need somthing like that
setuser Max
create view custview as (select easter customers...)
setuser Julia
create view custview as (select western customers...)
But the application does not have a right to create a LOGIN !
So the problem is that I have a admin role on my database but I want to create runtime limited users, they just see a part of data.
(Yes I have a sysadmin access but I want to solve it over my application, So I cannot call the security admin, hello bob give me a password, cause I need to add another user to my db and create views..)

Thnaks.
Tomas from Slovakia.

Thrasymachus
Constraint Violating Yak Guru

483 Posts

Posted - 2005-06-17 : 09:45:02
Maybe Views are not the way to go. How about a stored proc that calls the same fields but returns the customers based on who is logged in.

CREATE PROC GetMyCustomers
@loginid int
AS
SELECT Table1.Field1, etc..
FROM Table1
WHERE Table1.Salespersonid = @loginid

Sean Roussy

Please backup all of your databases including master, msdb and model on a regular basis. I am tired of telling people they are screwed. The job you save may be your own.
Go to Top of Page
   

- Advertisement -