title: How can I transfer a single table to another database in MSSQL server using VB.NET's SMO class?
body: <p>I can already create a database but when I use the code below, it transfers all the tables without any records. Additionally how would I code that only a single specific table will be transferred?</p>
  
  <pre><code>Dim conn As New ServerConnection("NPSS-OJT", "sa", "rms")
          Dim srv As New Server(conn)
          Dim db As Database = srv.Databases("bos_primary_db")
          Dim dbCopy As Database = New Database(srv, Main.dbName)
  
          Dim xfr As Transfer
          xfr = New Transfer(db)
          xfr.CopyAllTables = True
          xfr.Options.WithDependencies = True
          xfr.Options.ContinueScriptingOnError = True
          xfr.DestinationDatabase = dbCopy.Name
          xfr.DestinationServer = srv.Name
          xfr.DestinationLoginSecure = True
          xfr.CopySchema = True
          xfr.CopyData = True
  
          xfr.TransferData()
  </code></pre>
  
  <p>Updated Code:</p>
  
  <pre><code>Shared Sub transferTables()
          Dim conn As New ServerConnection("NPSS-OJT", "sa", "rms")
          Dim srv As New Server(conn)
          Dim db As Database = srv.Databases("bos_primary_db")
          Dim dbCopy As Database = New Database(srv, Main.dbName)
  
          Dim xfr As Transfer
          xfr = New Transfer(db)
          xfr.CopyAllTables = False
          xfr.Options.WithDependencies = False
          xfr.Options.ContinueScriptingOnError = True
          xfr.DestinationDatabase = dbCopy.Name
          xfr.DestinationServer = srv.Name
          xfr.DestinationLoginSecure = True
          xfr.CopySchema = True
          xfr.CopyData = True
          xfr.Options.DriAll = False
          xfr.Options.DriDefaults = True
          xfr.Options.DriIndexes = True
          xfr.Options.DriPrimaryKey = True
          xfr.Options.DriUniqueKeys = True
          xfr.Options.DriForeignKeys = False
          xfr.ObjectList.Add("Accounting")
          xfr.TransferData()
      End Sub
  </code></pre>