Page 1 of 1 1
Topic Options
#143809 - 2005-07-19 09:00 AM Attach DB files to MSDE
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
Hi,

Where can I find some info or example code to attach a .mdf and .log file to a new installation of msde?

have searched but missed the right one!!

Thanks Peter

Top
#143810 - 2005-07-19 01:52 PM Re: Attach DB files to MSDE
Stevie Offline
Starting to like KiXtart
*****

Registered: 2002-01-09
Posts: 199
The easiest way is to use the Microsoft SQL-DMO COM objects. The object from that library you want to look at is SQLServer which contains a method called 'AttachDB'. It takes a multistring value to grab both the .mdb/.ldb files. Should give you just what you want.
_________________________
Stevie

Top
#143811 - 2005-07-19 06:40 PM Re: Attach DB files to MSDE
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
And that would be:

Code:

sp_attach_db 'Database name',
'path to data file\datafile.mdf',
'path to logfile\logfile.ldf'



Also see: MS page on SP_ATTACH_DB
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#143812 - 2005-07-19 06:41 PM Re: Attach DB files to MSDE
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
And this can be done outside of the regular GUI Tools using osql.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#143813 - 2005-07-20 08:16 PM Re: Attach DB files to MSDE
pvds Offline
Hey THIS is FUN
*****

Registered: 2001-04-14
Posts: 201
OK thanks,

Wil give the osql tool a try

Peter

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.051 seconds in which 0.022 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org