0

How can I upgrade my SQL Server Express database file from 2008 to 2012 using C#?

I made program a few years ago. Now, I want to create an exe file for a customer, which should upgrade the database file to the 2012 database version.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    If your customer has a SQL Server 2012 instance, he can easily restore a backup (`.bak`) from a SQL Server 2008 Express instance. Or he can just attach a `.mdf` to his server - it will be upgraded automatically. This database upgrade is always done by **SQL Server** - I don't know of any way to do that separately, from code. – marc_s Jul 19 '14 at 08:17
  • hi.I want upgrade myself and without user hand , – shahriyar abbaspoor Jul 19 '14 at 09:06
  • how can detect database file version ? – shahriyar abbaspoor Jul 19 '14 at 09:06
  • [See this other SO question (and answers)](http://blogs.msdn.com/b/pranav_rastogi/archive/2012/02/20/mapping-sql-mdf-file-versions-to-sql-product-versions.aspx) on how to detect the internal database file version. But again: I **don't think there's any way** you can upgrade this from C# code ..... you'll have to let SQL Server do this for you – marc_s Jul 19 '14 at 09:18

0 Answers0