Solved

Using db_chaining in sql2005

Posted on 2011-03-01
3
907 Views
Last Modified: 2012-06-27
I wanted to use db_chaining with our sql205 instance, if I have 5 databases ( same table ) name which I'm going to set ON for db_chaining. Then If I want to query data for all these 5 databases in single query ? how should my scripts works ?
actually what is db_chaining use for ?
0
Comment
Question by:motioneye
3 Comments
 
LVL 7

Accepted Solution

by:
FemSteenkamp earned 167 total points
ID: 35005759
DB chaining has just got to do with the permissions needed to access underlying tables.

you will still have to use something like linked servers or openrowset function with some joins to get a single result.

can you elaborate a bit more about what you want to achieve?
0
 
LVL 25

Assisted Solution

by:reb73
reb73 earned 167 total points
ID: 35005866
You don't have to enable db_chaining to query from 5 databases on the same server. Provided a login has access to the databases and is mapped to a database user, you can use the three part object reference (<dbname>.<schema>.<object>) to access objects across  multiple databases.

With db_chaining enabled, a login does not have to be necessarily mapped to a database user, but still needs to be given explicit access to the target databases and the 'guest' database user is used to map into the objects required..

Review the link below, which gives you an idea of how it works and possible security issues using db_chaining -

http://www.mssqltips.com/tip.asp?tip=1782
0
 
LVL 15

Assisted Solution

by:Aaron Shilo
Aaron Shilo earned 166 total points
ID: 35005868
hi
for retriving data from all tables you will need to query them normally by referencing the SERVER.DB.SCHEMA.TABLE.

DB_CHANING
from msdn : "Use the Cross DB Ownership Chaining option to configure cross-database ownership chaining for the instance of SQL Server. This security enhancement was added in SQL Server 2000 SP3 to allow you to manage cross-database security.

This server option allows you to control cross-database ownership chaining at the database level or to allow cross-database ownership chaining for all databases:
"
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question