How to create update Database scripts?

Apr 25, 2011 at 12:12 AM
Edited Oct 24, 2011 at 6:51 PM

Hello, This one for BenAmada, and Rtur and anyone else that knows how to do this.

I am currently in the process of updating my fork:


The only thing that I do not know how to do is make the update scripts for the databases.  I mainly only know xml and not much

of database stuff.


How do I create the update scripts?  I only need to insert  4 elements to the pages table.  PageName,LinkName,Sort,Menu.

Any help would be great. 


Also did a search for specific BlogEngine posts about this and could not find any.

Are there any articles or places I can go to learn how to do this? Besides the Microsoft site?


Also for Ben and Rtur how do you do the scripts for all of the databases?  What do you use and etc?




Brian Davis

Java Blog

Apr 26, 2011 at 9:14 AM

Hi.  Each DB has its own way to create scripts.

With SQL Server, if using Management Studio, you can right-click on a table or stored procedure etc and select "Script Table As..." -> "CREATE To..." and then clipboard, etc.  When doing this, it will script the table, but not usually indexes or triggers, if you're using those (and no data either).  You can script indexes and triggers separately by right-clicking on the index/trigger and going thru the same "Script Index As...", etc.

The other option for SQL Server which I will often use if to right-click on the database, "Tasks..." -> "Generate Scripts".  With this one, you can script all tables, all stored procedures, etc ... basically the whole database.  You can choose which tables, stored procedures, etc to script.  When you get to the Script Options wizard step, you can tell it to script Indexes, Triggers, Foreign Keys and even the Data in the table.  I usually always turn on Script Indexes, Foreign Keys, Triggers and Data too if I need the data to be scripted.

With MySQL, there are several different tools to manage that.  I use HeidiSQL, but also have Navicat installed too.  Navicat has an option to "dump" the DB or a table, which generates a script.  HeidiSQL has a separate "Export" option (in the top menu bar) that will create a script of the table definition and the data.

For SQL CE, I used this tool before to script the DB and data.

I need to learn about SQLite and how to use it, so can't really give you any info on that.

Apr 26, 2011 at 2:45 PM

Thanks :)