Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Thursday, September 27, 2007

Copying a MDF SQLExpress Database file to SQL Server 2005 Server

Copying a MDF SQLExpress Database objects to SQL Server 2005:

  1. First make sure myDatabase.mdf is on your local machine unless you already
    have remote access enabled.

  2. Open Microsoft SQL Server Management Studio Express. Hint: Run as Administrator on Vista.

  3. Make sure myDatabase is listed as a Database in the Object Explorer,
    otherwise attach it.

  4. Right click myDatabase -> Tasks -> Generate Scripts -> [select]
    myDatabase -> Select All ... ->Script to new Query Window -> Finish


  1. In the Object Explorer open the remote database where you want the copied
    tables and views.

  2. Right click myTargetDatabase ->Tasks -> New Query

  3. Paste in copied script from step 4 from above.

  4. Run

link to download Microsoft SQL Server Management Studio Express
Note: Be careful with constraint options. I also had to copy and paste the data from the source to target data tables in Microsoft SQL Server Management Studio Express like an Excel copy and paste.


Anonymous said...

Can anyone recommend the well-priced RMM tool for a small IT service company like mine? Does anyone use or How do they compare to these guys I found recently: N-able N-central service management
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

Alex said...

Usually for solve problems with sql server and files too I use other tools. But yesterday no one of theirs couldn't help me. All my sql files were damaged. But luckily for me I found in the Internet - repair database sql. It helped me for seconds and for free as I kept in mind.