xml - Get SQL Server instance name from registry -
i'm trying create database , run sql scripts windows installer, works fine long hard-code server name. if try server name registry, installer fail. in case, have 32-bit sql server installed on 64-bit os, i'm using following registry key:
<property id="sql_server_instance"> <registrysearch id="rs_serverinstance" type="directory" root="hklm" key="software\wow6432node\microsoft\microsoft sql server\instance names\sql" name="sqlexpress" /> </property>
then plug property database setup:
<sql:sqldatabase id="newsqldb" database="wix_test_db" user="users" server="[sql_server_instance]" createoninstall="yes" droponuninstall="yes" continueonerror="no" > <sql:sqlscript ..."/> </sql:sqldatabase>
and fail. i've checked registry , name/value pair there "sqlexpress" , value not server instance. server called "sqlexpress", if it's stored name, need know in advance able search it, defeating purpose of attaining in first place.
i understand why code doesn't work, don't know how can server name. i've read can use [sqlserver] sqldatabase@server default server, installer still failed when tried this.
is there way server name (not using registry)?
actually mssqlserver
default sql instance, , reserved keyword can't used in instance name according this, think looking sql instances, if you can find in path hkey_local_machine\software\microsoft\microsoft sql server
there value called installedinstances
contains instances names , if use code registry keys brought lists. keep in mind path works if have default named instances or named instances, , after should exclude mssqlserver
list
Comments
Post a Comment