• Hello sam 55243,

    Instead of writing code for this problem, I advice you to use SSMA (SQL Server Migration Assistant)

    This is a free tool provided by Microsoft for Migration purpose from various database servers to MS SQL Server

    You can find much information on this link

    http://blogs.msdn.com/b/ssma/archive/2012/01/31/microsoft-sql-server-migration-assistant-ssma-5-2-is-now-available.aspx

    Hope this will be helpful to you

    Thanks.....:-)