Solved

SQL Serv 2005 Create instance through code...

Posted on 2006-06-30
2
264 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
Comment Utility
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]
Comment Utility
>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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
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…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

728 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now