Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-02-20 : 09:21:47
|
| Deep Kumar writes "Hello, I am doing a project in which i need to create a new database every new financial year. The database is sql server 7 under windows 2000. Front end is VB6. I wrote a stored procedure in which, i detached the database, executed a copy command and attached again. But only the data file(.mdf) is getting copied. When i try to copy the ldf file i get an error : "Server: Msg 5105, Level 16, State 4, Line 1 Device activation error. The physical file name 'D:\MSSQL7\DATA\Test_log.ldf". I need the transactional log file later, to create a new database, using the already copied the .mdf file, using the FOR ATTACH syntax. There, if i did not give the log file name, i get an error. That is why i tried to copy the .ldf file also . Can anybody help me in solving the problem?. Your early reply will help me. Is there any better option to create new database with all objects of old databaseRegards Deep" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-02-20 : 09:28:52
|
| Do you need to keep the data, or just the objects? If only the objects, you can:1. Generate Scripts for the database, then run the script in a new database.2. Use DTS to transfer the database objects to the new database.If you need to keep the data, you can still use the 2nd option, and also:3. BACKUP the database and RESTORE it to the new database. This requires a full database backup.4. Try sp_attach_single_file_db instead.The last method will create a new, empty log file, and only requires you to attach the data file (.MDF)Books Online describes these methods. |
 |
|
|
|
|
|
|
|