Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Creating database by using command window

Author  Topic 

csecharith
Starting Member

21 Posts

Posted - 2007-11-14 : 00:39:11
Hi,

I am in the process of creating a windows installer. I am using SQL Server 2005 for my application. I have generated the script for my database. I want to run that script and create my database on the client machine (client has installed SQL 2005). Do you have any solution for this kind of issue?

When run an installer I can run a bat file. Can I create a bat file and create my database? Does SQL Server2005 provide any tool for this?

Thanks!
CJ

evilDBA
Posting Yak Master

155 Posts

Posted - 2007-11-14 : 04:09:58
You need to execute CREATE DATABASE command.

However, I dont like tools that do it. DATABASES in SQL have hundreds different options. So to create a database properly you need to redo what is done in SQL Management Studio.

You should create it by default (and it will be created on C: :) ) or ask user where put the DATA, LOG, autogrowth, compatibility level, recovery model... blah blah... not a good idea to ask all these questions during the installation.

Go to Top of Page

dirtydavey
Yak Posting Veteran

80 Posts

Posted - 2007-11-14 : 05:27:28
Are you trying to create a database from a batvh file? If so can you not use isql?
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-11-14 : 23:21:33
You can run sql script with sqlcmd in dos prompt.
Go to Top of Page
   

- Advertisement -