Click here to Skip to main content
6,822,613 members and growing! (16,618 online)
Email Password   helpLost your password?
Database » Database » MySQL     Beginner License: The BSD License

SQL Server to SQL Server Compact Edition Database Copy Utility

By johnnycantcode

Create and manage your mobile database using SQL Management Studio and export them to SQL Compact Edition databases
C#, SQL, Windows, SQL-Server (SQL2000, SQL2005, SQL-CE), WinForms, Dev
Revision:2 (See All)
Posted:29 Apr 2008
Updated:26 Jun 2008
Views:51,815
Bookmarked:73 times
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
23 votes for this article.
Popularity: 6.54 Rating: 4.80 out of 5

1
1 vote, 4.3%
2
1 vote, 4.3%
3
1 vote, 4.3%
4
20 votes, 87.0%
5

UPDATE

Please download the latest version of this tool from JohnnyCantCode.com. I have updated this utility based on some feedback from users.

I added the ability to select the schema you wish to copy. For most databases, this will simply be "dbo".

I fixed a bug where the application did not recognize a valid version of "System.Data.SqlServerCe.dll".

Introduction

This utility will copy the schema and data from a normal SQL Server 2000/2005 database and export it to a SQL Server Compact Edition database. The tool supports version 3.1 or 3.5 of SQL Server Compact Edition.

Background

I was working on a mobile application and needed an easy way to manage the table relationships and indexes without having to resort to scripting. I was familiar with using SQL Server Management Studio so I decided that I would write a utility that converted a normal SQL Server database to a mobile database. This way, I could continue using the tool I normally use to create and maintain my databases.

Using the Code

Feel free to take a look at the code and offer your most gracious comments. The application uses a wizard to walk you through converting a database. I have also included a normal WINFORM that also does the conversion, but I stopped development on this in lieu of the wizard, so the form is incomplete. I will be maintaining this code and writing more about it on my blog at www.JohnnyCantCode.com. You can find the original post here.

Points of Interest

This utility will copy Indexes, Primary Keys, Foreign Keys, Table structure and data. SQL Server Compact Edition does not have support for Views, Triggers nor Stored Procedures, therefore this utility does not copy these.

History

  • 1.0 Initial release

License

This article, along with any associated source code and files, is licensed under The BSD License

About the Author

johnnycantcode


Member
I work as an independent software architect and senior developer. I have worked on many large enterprise projects as well as small single user applications.
Occupation: Software Developer (Senior)
Company: Gologic Tech LLC.
Location: United States United States

Other popular Database articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 32 (Total in Forum: 32) (Refresh)FirstPrevNext
QuestionException where Copying Database PinmemberEdgarVegaD5:36 14 Jan '10  
AnswerRe: Exception where Copying Database PinmemberEdgarVegaD9:14 14 Jan '10  
GeneralGETUTCDATE() & Multi-Column Key's Pinmembermichael@merlot.com5:41 21 Nov '09  
GeneralFor SQL Server CE 3.5 SP1 Pinmemberkshakir11:08 23 Jul '09  
QuestionSql 2008 support? Pinmemberkhanricksteele8:26 29 Apr '09  
QuestionUnknown datatype PinmemberMember 18712530:38 19 Mar '09  
AnswerRe: Unknown datatype PinmemberMember 26515737:32 16 Jun '09  
GeneralPrimery Keys are not correct after import to SQL Compact Pinmembervoellinger1:51 26 Jan '09  
GeneralOut of memory error Pinmembercess10:36 30 Nov '08  
Generalthere is problem with NVARCHAR(MAX) PinmemberTajniak56:51 20 Nov '08  
Generaliv been messing with this for a while until i found this.TNX!!!!! Pinmemberzivzuv21:37 18 Nov '08  
Generalprimary key contraint names Pinmembermape10826:04 19 Aug '08  
GeneralRe: primary key contraint names PinmemberFrancois YACOB7:38 16 Jun '09  
GeneralThis thing rocks! Pinmembersholliday11:32 5 Aug '08  
GeneralGreat work!!! only one thing and an Idea for future work Pinmembermape10827:19 23 Jul '08  
GeneralRe: Great work!!! only one thing and an Idea for future work PinmemberFrancois YACOB7:43 16 Jun '09  
GeneralType Conversion errors Pinmembergratajik14:25 15 Jul '08  
GeneralON DELETE ... ON UPDATE ... PinmemberHoang Cuong23:21 12 Jul '08  
Generaldata transfer PinmemberShaikh Sahrif20:18 28 Jun '08  
GeneralBrilliant PinmemberJohnny J.21:44 26 Jun '08  
GeneralError after conversion.. Opening converted file with SQL Management Studio PinmembermGxAlander18:46 5 Jun '08  
GeneralRe: Error after conversion.. Opening converted file with SQL Management Studio Pinmemberjohnnycantcode10:34 12 Jun '08  
GeneralNot working with SQL2000 Pinmemberoldieman23:28 2 Jun '08  
GeneralVisual Studio Pinmembergnassar3:26 2 Jun '08  
GeneralRe: Visual Studio Pinmemberjohnnycantcode10:35 12 Jun '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.

PermaLink | Privacy | Terms of Use
Last Updated: 26 Jun 2008
Editor: Deeksha Shenoy
Copyright 2008 by johnnycantcode
Everything else Copyright © CodeProject, 1999-2010
Web18 | Advertise on the Code Project