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)
 Query in multiple dbs

Author  Topic 

lab
Starting Member

14 Posts

Posted - 2005-04-08 : 13:37:37
Hi all !

I had to install security on a DB but the people that asked for the security asked for a security not by tables but by records (don't think its possible)... What I tought of doing is to create one DB with same layout per user ... but now some user have the rights on other users DB and when they do a query, the query as to return the result from multiple DB that have the same layout and everything as to be transparent for the user ...

Anyone got an idea on how i can do a query that query multiples database (it would accually have to query all the DBs and return result only on the ones that the user as access)... BTW these query have to be able to run in Crystal reports for reporting purposes...

Steve

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2005-04-08 : 13:48:16
create a SP for the Records with rights and give rights to the SP.

Jim
Users <> Logic
Go to Top of Page

lab
Starting Member

14 Posts

Posted - 2005-04-08 : 13:57:48
do you mean to create a SP that will look into all DBs to return the records ? If so .. how can I ask Crystal reports to lauch a SP instead of a normal query ? Hey how bout a trigger ... Can I rewrite the SELECT method so it searches into multiple DBs?
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-04-08 : 16:10:56
If you need data across many databases prefix your fields with NameOfDb.dbo.Yourtable.FieldName
For instance if you have a database called Blah with a table called Foo with a field called bar

Blah.dbo.Foo.Bar is what you want, do this for each db field.


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

lab
Starting Member

14 Posts

Posted - 2005-04-11 : 14:45:31
Great ... im gonna try that ..

thx
Go to Top of Page

kitwest
Starting Member

2 Posts

Posted - 2005-04-11 : 17:25:19
If the goal is to provide security by row level, why not deny select on the tables, and grant select on views which filter the authorized rows?
Go to Top of Page
   

- Advertisement -