PhilZone
Welcome to the phil zone

Navigation

Home
Green House
River Cottage
About
PhotoLogs
Certification
SongLyrics
SystemAdmin
Network
Security

I Read

Anil
HouleDude
Woof
Scripting
Joel
RobGalbraith
Carlos
Sam
Mary
Steve
xkcd
UserFriendly
Indexed
QuestionableContent
RealLife
Dilbert
Tugster
NYT
Weather
Radar
News

Stuff

WebMail
QuesoKnow

SQL Move File

move files

USE master

GO

-- First determine the number and names of the files in the backup.

RESTORE FILELISTONLY

    FROM MyNwind_1

-- Restore the files for MyNwind.

RESTORE DATABASE MyNwind

    FROM MyNwind_1

    WITH NORECOVERY,

    MOVE 'MyNwind_data_1' TO 'D:MyDataMyNwind_data_1.mdf',

    MOVE 'MyNwind_data_2' TO 'D:MyDataMyNwind_data_2.ndf'

GO

-- Apply the first transaction log backup.

RESTORE LOG MyNwind
    FROM MyNwind_log1

    WITH NORECOVERY

GO

-- Apply the last transaction log backup.

RESTORE LOG MyNwind
    FROM MyNwind_log2

    WITH RECOVERY

GO


Last update: Wednesday, 22-Sep-2004 15:44:10 PDT
Copyright 2002-2009 - PhilZone