SQL Fiddle: a tool for database developers


SQL Fiddle is a tool for database developers to test out their SQL queries.  If you do not know SQL or basic database concepts, this site is not going to be very useful to you.

[ link ]

See also: JsFiddle, a playground for web developers

How to test an SQL Server connection

  1. Create a new empty text document (.txt) on your pc. (e.g.: on your desktop)
  2. Rename it to X.UDL
  3. Double click the file to open the Data Link Properties
  4. Select the correct provider on the [Provider] tabpage
    Fill in your connection details on the [Connection] tabpage
  5. Click [OK] to close the Data Link Properties window when you have a succesful connection (via [Test Connection])
  6. Now open the X.UDL with your favorite text editor (e.g.: notepad, notepad++)
    You should see your connection string now!


EF Code First change the default generated database name

I’m playing around with ASP.NET MVC 3 + EF Code First. At a testing stage my models change often. To always have some clean content when building and running the project I have overridden the Seed method in my custom database initializer class (inherit from DropCreateDatabaseIfModelChanges<T>).

using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using Test.Models;

namespace Test.DAL
public class TestInitializer : DropCreateDatabaseIfModelChanges<TestContext>
protected override void Seed(TestContext context)
var categories = new List<ProductCat>
new ProductCat { Name = "Wood" },
new ProductCat { Name = "Metal" },
new ProductCat { Name = "Plastic" }

var products = new List<Product>
new Product { Name = "Bench", ProductCat = categories.Single(c => c.Name == "Wood")},
new Product { Name = "Bottle", ProductCat = categories.Single(c => c.Name == "Plastic")},
new Product { Name = "Electric cable", ProductCat = categories.Single(c => c.Name == "Metal")}

products.ForEach(p => context.Products.Add(p));


Now if you have SQL Server Management Studio (SSMS) open, you will see that your generated database is something like Project.Namespace.Class, which is actually not a good name. To change that EF Code First generated name you can do something like this in your DbContext class:

using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;

namespace Test.Models
public class TestContext : DbContext
public TestContext()
: base("MyNewDBName") // <-- database name
{ }

public DbSet<Product> Products { get; set; }
public DbSet<ProductCat> Categories { get; set; }

protected override void OnModelCreating(DbModelBuilder modelBuilder)

Keep in mind that this is only one of the places where you can change the default database name.

Now your database will be called MyNewDBName in SSMS.
Have fun ;-)

ASP.NET: Adding Membership to an mdf file

In case you need to add Membership to an *.mdf file you need to use the tool: aspnet_regsql.exe.

This tool can be found in:


In my case it was:


Now getting the tool working with an *.mdf file (MyData.mdf) should be done like this:

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regsql.exe -C "Data Source=
.\SQLEXPRESS;Integrated Security=True;User Instance=True" -d "C:\Users\Teusje\do
cuments\visual studio 2010\Projects\MySite1\MySite1\App_Data\MyData.mdf" -A all

Start adding the following features:




More information about can be found here and here (msdn).

Enjoy ;)

WebMatrix (beta)

(pictures from ScottGu‘s blog)

WebMatrix is everything you need to build Web sites using Windows. It includes IIS Developer Express (a development Web server), ASP.NET (a Web framework), and SQL Server Compact (an embedded database). It streamlines Web site development and makes it easy to start Web sites from popular open-source apps. The skills and code you develop with WebMatrix transition seamlessly to Visual Studio and SQL Server.

[ source ] [ source2 ]