using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Management.Smo;
namespace DirectURNAccess
{
    class Program
    {
        static void Main(string[] args)
        {
            Server Canopus = new Server("CANOPUS5");
            Table Authors = (Table)Canopus.GetSmoObject(
              new Urn(@"Server[@Name='CANOPUS5']
              /Database[@Name='pubs']
              /Table[@Name='Authors' and @Schema='dbo']"
              ));

            Server local = new Server();
            Table Authors2 = (Table)local.GetSmoObject(
              new Urn(@"Server
              /Database[@Name='pubs']
              /Table[@Name='Authors' and @Schema='dbo']"
              ));

            // following will throw exception
            Server local2 = new Server("CANOPUS5");
            Table Authors3 = (Table)local.GetSmoObject(
              new Urn(@"Server[@Name='PLUTO5']
              /Database[@Name='pubs']
              /Table[@Name='Authors' and @Schema='dbo']"
              ));

        }
    }
}
