Solved

SQL Serv 2005 Create instance through code...

Posted on 2006-06-30
2
265 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
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 142

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Help 27 45
Query Help - MSSQL - Averages 5 27
Flattening heirachies 3 31
SQL invalid column name 5 13
Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

803 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