Sure, I do this all the time in Windows Marketplace: <SqlString Id="RollbackDetach" SqlDb="LocalMasterDB" RollbackOnUninstall="yes" ContinueOnError="yes" Sequence="1" SQL="CREATE DATABASE $(var.LongDBName) ON (FILENAME=N'[#Baseline.mdf]'), (FILENAME=N'[#Baseline.ldf]') FOR ATTACH" /> <SqlString Id="OfflineDatabase" SqlDb="LocalMasterDB" ExecuteOnUninstall="yes" ContinueOnError="yes" Sequence="2" SQL="ALTER DATABASE $(var.LongDBName) SET OFFLINE WITH ROLLBACK IMMEDIATE" /> <SqlString Id="Detach" SqlDb="LocalMasterDB" ExecuteOnUninstall="yes" ContinueOnError="yes" Sequence="3" SQL="EXEC sp_detach_db @dbname='$(var.LongDBName)', @skipchecks='true'" />
<SqlString Id="Attach" SqlDb="LocalMasterDB" ExecuteOnInstall="yes" Sequence="4" SQL="CREATE DATABASE $(var.LongDBName) ON (FILENAME=N'[#Baseline.mdf]'), (FILENAME=N'[#Baseline.ldf]') FOR ATTACH" /> <SqlString Id="RollbackAttach" SqlDb="LocalMasterDB" RollbackOnInstall="yes" ContinueOnError="yes" Sequence="5" SQL="EXEC sp_detach_db @dbname='$(var.LongDBName)', @skipchecks='true'" /> Sajo Jacob wrote: > > I have a scenario where I have to restore a database from an mdf/ldf > on to the target machine during the installation which I was planning > on accomplishing by : > > 1) Copying the mdf/ldf to a *MySoftware/Data * folder > > 2) Calling a sql script *AttachDB.sql * (using the SqlScript > element) which does a *EXEC sp_attach_db* and attachs the mdf to a > newly created database > > but the roadblock I see is that I want to attach the mdf from the > *MySoftware/Data* (from step 1) which is configurable by the user to > be installed on any drive. > > Neither attaching the mdf from the CD like shown below or using a > hardcoded *MySoftware/Data* location does not help in this case; > > *AttachDB.sql* > > EXEC sp_attach_db @dbname = 'MyCDatabase', > > @filename1 = 'E:\CD_DriveFolder\WiXTest.mdf', > > @filename2 = 'E:\CD_DriveFolder\WiXTest_log.ldf' > > Can something like this be done from WiX without using a VBScript? > > Jacob > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ------------------------------------------------------------------------ > > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users > ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users