Thursday, February 11, 2010

Installing Sql-server 2005 express edition using cmd (Silent Mode)

Today I am going to share how to install sql-server 2005 express edition using cmd (command prompt) which is also known as silent mode or non-interactive mode. Also refer to my post regarding performing silent install of sql-server 2005 using This method of installation is very helpful if one is bundling the sql-server 2005 express edition with another product which is going to use it. The command prompt parameters are as follows:
start /wait C:\SQLSERVER2005\SQLEXPR32.EXE /qb username="CustomerUsername" companyname="OurCompany" addlocal=ALL  disablenetworkprotocols="0" instancename="MyInstance" SECURITYMODE="SQL" SAPWD="MyPassword"

This would successfully install the sql-server 2005 express edition to the system. Now to login into the sql-server use the following command in cmd:

sqlcmd -S PC100\MyInstance -U sa -P MyPassword

After successful login we would require to attach a database. To attach a database use following command:

( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MyDB_Data.mdf' ),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\MyDB_log.ldf' )

This would successfully attach the database. Now you are ready to use the database.


  1. Quite a nice post. It really helped me in managing the installation at the client side. Thanks !:)

  2. looks great. The parsing of corrupted documents can be also performed by the sql recovery tools, it is the fastest way to open affected files

  3. This is brilliant !!! Thanks for the code. Just to add one more thing this type of silent installation is also known as unattended installation. Good work Jai.

  4. Thanks @Meera for the update. You are right, the silent installation is also known as un-attended installation, no-interaction installation and one-click installation.

  5. Thank you very much for your article.


Comments to this post


Related Posts with Thumbnails