2

I'm updating a program for my company that requires the user to have SQL Server 2005 Express or later installed on to their computer. We already ship it with a copy of the SQL Server 2008 Express installer, but how do I get the launch conditions to check for any SQL Server of 2005 or later?

The reason I need to be sure that SQL is installed is that I'm trying to automate a process where we had the user create a database and give that database permissions for certain users. I have someone who can help me with creating the automation process, but he has never had to do the installation package for such a process.

I'm guessing that I would need to put a custom action to call the SQL file in the Commit phase of the Installer. Is that correct?

To reiterate my questions: How do I make sure SQL Server 2005 Express or later is installed on the target machine with Visual Studio Installer Deloyment? And how do I run an SQL query at the end of an install?

Thank you for any help you can give me.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Tory
  • 520
  • 3
  • 13
  • Check this http://stackoverflow.com/questions/141154/how-can-i-determine-installed-sql-server-instances-and-their-versions – Maysam Aug 30 '11 at 15:59
  • Unfortunately, that's not what I need. I need to know how to check if SQL is installed using the Visual Studio Deployment Launch Conditions. i.e. when someone else tries to install the program. – Tory Aug 30 '11 at 16:08
  • why you don't use install systems like NSIS? – Maysam Aug 30 '11 at 16:18
  • whatever, take a look http://support.k2techno.com.au/?W563 – Maysam Aug 30 '11 at 16:20
  • That looks like what I could do to make sure that they have SQL Server 2005 or later, as SQL Native Client looks to be necessary for everything like that. Thank you. Could you make that a full fledged Answer so I could mark it as such - as it does answer my first question? – Tory Aug 30 '11 at 16:31

2 Answers2

0

May these help:
http://msdn.microsoft.com/en-us/library/bb264562(v=sql.90).aspx
http://community.flexerasoftware.com/showthread.php?t=155357

Maysam
  • 7,246
  • 13
  • 68
  • 106
0

You didn't mention what setup authoring tool you are using.

The general approach for checking SQL Server 2005 as a launch condition is this:

  • create a registry search for this entry:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ClientSetup\CurrentVersion

  • use the search property as a custom launch condition

  • the search property value should be greater than or equal to "9.0" for the condition to be true

For example, if the search property is SQL_SERVER_2005_SEARCH, you can use this launch condition:

SQL_SERVER_2005_SEARCH >= "9.0"

Windows Installer doesn't support SQL scripts, so they are usually executed through custom actions. There is no predefined support for this, so you will most likely need to write the custom action code yourself.

Most commercial setup authoring tools have built-in support for both launch conditions and SQL scripts. Some free tools may also offer something for them.

Cosmin
  • 21,216
  • 5
  • 45
  • 60
  • That looks like it would work, but I want to make sure that this condition will not fire if they have SQL Server 2008. For Example: They don;t have any type of SQL Server installed, so it will fire. They have SQL 2000 of some kind installed, it fires. They have SQL 2005, so it does not fire. They have SQL 2008 installed, it does not fire. Is this correct? Also, how would I do the custom Action? Simply add the SQL file to the Commit Phase? Would that run it automatically? – Tory Aug 30 '11 at 18:40
  • SQL Server 2008 uses a different registry entry, for example "SOFTWARE\Microsoft\Microsoft SQL Server\SQLSERVER2008\MSSQLServer\CurrentVersion". So you would need another search and combine the two conditions. Regarding SQL scripts, Visual Studio doesn't support them. You would need to write your own custom action with custom code to execute them. – Cosmin Aug 30 '11 at 19:10