473,387 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Server install script

Ty
This one is stumping me.. please help.

I put together a DB with lots of tables, sprocs, etc..

Now I want to wrap it up into one nice little .SQL which will generate
everything for a user. To that end, I went into Enterprise Manager, and
selected "Generate SQL script".

All is well until someone wants to execute it on a machine where SQL is not
installed in the same DIR where I have SQL installed. So.. how do I generate
a CREATE script which is smart enough to create the DB in the same physical
path where SQL is installed for that particular user?

Have I lost you yet? Here is a snippet of the DDL:

<paste>

IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'MyNewDB')

DROP DATABASE [MyNewDB]

GO

CREATE DATABASE [MyNewDB] ON (NAME = N' MyNewDB _Data', FILENAME =
N'C:\Program Files\Microsoft SQL Server\MSSQL\data\ MyNewDB_Data.MDF' , SIZE
= 34, FILEGROWTH = 10%) LOG ON (NAME = N' MyNewDB_Log', FILENAME =
N'C:\Program Files\Microsoft SQL Server\MSSQL\data\ MyNewDB.LDF' , SIZE =
344, FILEGROWTH = 10%)

COLLATE SQL_Latin1_General_CP1_CI_AS

GO

</paste>

OK.. how do I make the areas in BOLD write to <%SQLSERVERINSTALLPATH%>, or
something like that?

Thanks!

/Ty
Jul 20 '05 #1
1 4875
Hi

Using create database with no on clause will create a mdf and ldf in the
default locations. This is not necessarily where the SQL Server program was
installed, and is probably the better location.

You can then use sp_helpfile to find out the actual locations if you want to
add new files, or use
ALTER DATABASE to change the files there were created.
CREATE DATABASE Test2
USE TEST2
sp_helpfile

ALTER DATABSE Test2
MODIFY FILE (NAME=Test2, SIZE=34MB, FILEGROWTH=10MB )

Also I would always fix the FILEGROWTH to a value in MBs as the growth will
be exponential if left as a percentage.

Your initial size of the log file seems excessive especially when compared
to the initial size of the data file.

John

"Ty" <tybala on the server at hotmail.com> wrote in message
news:53******************************@news.teranew s.com...
This one is stumping me.. please help.

I put together a DB with lots of tables, sprocs, etc..

Now I want to wrap it up into one nice little .SQL which will generate
everything for a user. To that end, I went into Enterprise Manager, and
selected "Generate SQL script".

All is well until someone wants to execute it on a machine where SQL is not installed in the same DIR where I have SQL installed. So.. how do I generate a CREATE script which is smart enough to create the DB in the same physical path where SQL is installed for that particular user?

Have I lost you yet? Here is a snippet of the DDL:

<paste>

IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'MyNewDB')
DROP DATABASE [MyNewDB]

GO

CREATE DATABASE [MyNewDB] ON (NAME = N' MyNewDB _Data', FILENAME =
N'C:\Program Files\Microsoft SQL Server\MSSQL\data\ MyNewDB_Data.MDF' , SIZE = 34, FILEGROWTH = 10%) LOG ON (NAME = N' MyNewDB_Log', FILENAME =
N'C:\Program Files\Microsoft SQL Server\MSSQL\data\ MyNewDB.LDF' , SIZE =
344, FILEGROWTH = 10%)

COLLATE SQL_Latin1_General_CP1_CI_AS

GO

</paste>

OK.. how do I make the areas in BOLD write to <%SQLSERVERINSTALLPATH%>, or
something like that?

Thanks!

/Ty

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Nancy | last post by:
Hi, Guys, Is there any other way to use python or mod_python writing a web page? I mean, not use "form.py/email", no SMTP server. <form action="form.py/email" method="POST"> ... Thanks a lot. ...
4
by: manatlan | last post by:
In an intranet/lan, i'd like to put a "python server script" (which run forever) on a computer A... On another computer B, I'd like to send smtp-email to the computer A ... (send to...
2
by: Jane | last post by:
Hello, I get the error Error Occured Reading Records: Server has not yet been opened. when I am trying to view a report using the asp pages for crystal reports. It works fine for access files....
1
by: Morten | last post by:
Hi! I'm trying to configure Frontpage Server Extensions by means of an ASP page. I've used the following code to configure it: Sub ConfigureFrontpageExtensions (FPUser, HostHeader) FPRoot =...
4
by: banz | last post by:
Hello I have a problem to resolve: I wrote a Perlscript which caches data from a server (local on my machine) I would like to have a other connection to a remote server but I don't know how to...
3
by: NWx | last post by:
Hi, I write an ASP,NET application who uses SQL Server (MSDE) as Back-end I'm an experienced developer, but haven't used SQL server before and I need some help. Since I don't have full SQL...
2
by: Kevin R | last post by:
I'm trying to get asp.net 1.1 running on my home PC. When I try creating a new ASP.NET Web Application in 'Visual Studio .NET 2003' I get the following error: "Visual Studio .NET has detected...
17
by: Jon B | last post by:
Hi All! I have a ASP.NET 2.0 site that works on the Windows 2000 Server. However, when I tried to view this site on my local Windows XP machine, I get "Server Unavailable". If I switch the...
9
by: TC | last post by:
Like a lot of database developers, I often choose Jet for the back- end. I'm starting to worry about what will happen when Jet is deprecated. Ostensibly, Jet users like me must switch to SQL Server...
10
by: =?Utf-8?B?UHVuaXQgS2F1cg==?= | last post by:
Hi, I am developing a windows application in VS.NET 2005. The application is database driven and I need to deploy it on a client's pc. How should I go about developing such an application. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.