tags:

views:

36

answers:

2

How to identify if sql server 2005 express is installed using cmd

A: 

As a dirty hack, you can check whether sqlcmd command can be executed.

EDIT

yep, I was right.

To determine if you have MSDE or Microsoft SQL Server installed on your computer:

  1. On the taskbar at the bottom of your screen, click Start, and then click Search.
  2. In the Search dialog box, type sqlservr.exe
  3. Click OK.

    If this file is present on your system, then you have MSDE or SQL Server installed.

http://www.microsoft.com/security/updates/checkversion.aspx

Sorantis
A: 

It is not using a comman or sqlcmd but this will get you the version of the named server

using (var connection = new SqlConnection("Data Source=localhost;Integrated Security=true;initial catalog=master"))
{
    connection.Open();
    string version = connection.ServerVersion;
}
Sky Sanders