We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

osherk
Posts: 41
Joined: Mon Apr 20, 2015 11:55 am

Creating a new db on a sql server

Hi,

I want to create a msi that installs a new DB on an existing sql server (without DBs installed on it).
in the aip file I created a script that creates the new DB (Phone). I created the script by a generated script of the DB from another environment.
While running the exe in the target machine, I get the following error:
"Directory lookup for the file "E\ProgramFiles\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\...\Phone.mdf" failed with the operating system error 3(The system cannot find the path specified).)"

Of course the file won't be found because I run the query on a new machine.
How can I create the DB with all its tables instead of mdi file?

Thanks

The script is:

USE [master]
GO

/****** Object: Database [Phone] Script Date: 04/19/2015 14:22:49 ******/
CREATE DATABASE [Phone] ON PRIMARY
( NAME = N'Phone', FILENAME = N'E:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Phone.mdf' , SIZE = 1189248KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
LOG ON
( NAME = N'Phone_log', FILENAME = N'E:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Phone_1.ldf' , SIZE = 2304KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

ALTER DATABASE [Phone] SET COMPATIBILITY_LEVEL = 90
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [Phone].[dbo].[sp_fulltext_database] @action = 'disable'
end
GO

ALTER DATABASE [Phone] SET ANSI_NULL_DEFAULT OFF
GO

ALTER DATABASE [Phone] SET ANSI_NULLS OFF
GO

ALTER DATABASE [Phone] SET ANSI_PADDING OFF
GO
.
.
.
.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Creating a new db on a sql server

Hello and welcome to our forums,

To achieve what you want you can use our "SQL Scripts Replacement" support to resolve at install time the correct path, in your SQL script, of the MDF file.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
osherk
Posts: 41
Joined: Mon Apr 20, 2015 11:55 am

Re: Creating a new db on a sql server

yes, thanks
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Creating a new db on a sql server

You're welcome.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”