Attaching a database the express way

Are you also stuck with that stupid limited express edition of SQL Server 2005, which has no GUI whatsoever?

Well, I already tried the hassle of installing the Management Studio of the full blown SEL Server once – and I don’t feel like doing that any time again. So there has to be a better way.

OK – so check out the SSEUtil and with just:

SSEUtil.exe -s .\SQLEXPRESS -attach Northwnd.mdf

we get our beloved Northwind Database in SQL Express!

Wow – this is slick!


OK, the excitment settled pretty quick – seems like I cannot access that attached Database from anywhere. This makes attaching databases kinda useless.

Anyway, I figured another approach – and this time it’s for real. Try:

%ProgramFiles%\Microsoft SQL Server\90\Tools\Binn>SQLCMD.EXE -S.\sqlexpress -E -iattach.sql

where ‘attach.sql” contains the SQL to attache a database:

use master go exec sp_attach_db @dbname=’northwind’,@filename1=’C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\northwnd.mdf’ go

Leave a Comment.