Solved

SQL Serv 2005 Create instance through code...

Posted on 2006-06-30
2
269 Views
Last Modified: 2008-02-26
Hi...

I want to know how difficult it is to:

1- Create a new instance of the SQL SERVER 2005 on a computer
2- Attach a bunch of *.mdf files.

I need a way to perform this outside the Management Studio.
A batch file, thru command prompt commands... you name it.

I just need to trigger it from a .net application.

Thanks!
Alex
0
Comment
Question by:Alexandre Simões
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Accepted Solution

by:
devsolns earned 500 total points
ID: 17019939
if you are looking to do a silent install of SQL Server express edition look here:

Done through cmd prompt.
http://www.haidongji.com/2006/02/05/silent-install-command-line-install-of-sql-server-2005-part-4/

Then to attach a database is easy:

From cmd prompt:
sqlcmd -S Server\Instance

USE [master]
GO
CREATE DATABASE [database_name] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\<database name>.mdf' ),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\<database name>.ldf' )
 FOR ATTACH ;
GO


http://msdn2.microsoft.com/en-us/library/ms165673.aspx

Hope this helps:

--DS
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17020050
>1- Create a new instance of the SQL SERVER 2005 on a computer
as devsolns indicates, this is only possibly by installing sql server (silently)


0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question