you can use TransferDatabase command in macro
See the link for more info on this command
http://msdn.microsoft.com/en-us/library/bb177398.aspx