programming4us
programming4us
DATABASE

SQL Server 2008 : Working with Multiple-Source Queries - Using Four-Part Database Names & The DTC Explained

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
1/20/2011 3:57:59 PM

Using Four-Part Database Names

If the data is in another SQL server, complete the four-part name that is required to access data from the remote SQL server. Server.Database.Schema.ObjectNameSELECT or DML query. For SELECT, here is the query. is the four-part name. The four-part name may be used in the

SELECT * FROM [<server_name,sysname,(local)><instance_name,sysname,\
SQLEXPRESS>].<database_name,sysname,pubs>.<schema_name,sysname,dbo>.
<table_name,sysname,authors>
GO
Example: SELECT Name, Address FROM RMTSERVER.AdventureWorks.Person.Address

In case of other database types, often you won’t find the schema name. For example, in the MS Access example, you won’t see a database and schema with a match to the SQL server. In those cases you can avoid them by notation as given in the following example.

SELECT * FROM CUSTOMERACCESS...Customer

The DTC Explained

SQL Server uses the Distributed Transaction Coordinator (DTC) to handle multiple-server transactions, commits, and rollbacks. The DTC server uses a two-phase commit schema for multiple-server transactions. Here are the steps.

  1. Server is sent a prepare to commit message.

  2. Server performs the first phase of the commit, verifying that it is capable of committing the transaction.

  3. Server replies when it has finished preparing for the commit.

  4. After server has responded positively to the prepare to commit message, the actual commit message is sent to each server.

  5. DTC is required only when remote updates are occurring in the remote server.

Tip

There are three catalog views related to Linked Servers: sys.linked_logins, sys.servers, and sys.remote_logins. The most frequently used catalog view is sys.servers.

  SELECT * from sys.servers
WHERE is_linked = 1

The preceding query will return the list of linked servers attached to a SQL server.

Other  
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
REVIEW
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us
programming4us
 
 
programming4us