Click here to Skip to main content
6,294,871 members and growing! (16,195 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 mobiles database using SQL Management Studio and export them to SQL Compact Edition databases
C#, SQL, Windows, SQL Server (SQL 2000, SQL 2005, SQL CE), WinForms, Dev
Posted:29 Apr 2008
Updated:26 Jun 2008
Views:35,567
Bookmarked:58 times
Unedited contribution
Announcements
Loading...
 
Search    
Advanced Search
printPrint   Broken Article?Report       add Share
  Discuss Discuss   Recommend Article Email
20 votes for this article.
Popularity: 6.22 Rating: 4.78 out of 5

1
1 vote, 5.0%
2
1 vote, 5.0%
3
1 vote, 5.0%
4
17 votes, 85.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 and 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 normal 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 does the conversion also 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, therefor 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 28 (Total in Forum: 28) (Refresh)FirstPrevNext
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  
GeneralSchema Setting + SqlCe Version PinmemberCharl Victor0:27 13 May '08  
GeneralRe: Schema Setting + SqlCe Version Pinmemberjohnnycantcode4:22 13 May '08  
AnswerRe: Schema Setting + SqlCe Version PinmemberCharl Victor6:17 14 May '08  
GeneralTriggers and SP PinmemberMember 40695464:13 7 May '08  

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

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