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 |
|
smita
Starting Member
4 Posts |
Posted - 2002-03-06 : 12:39:10
|
| I am trying to copy database . I tried using attching and detaching database and copying it using SQL-DMO object. But I had problems like if anybody is using the database it just stops my vb script code throwing an error...I tried trapping the error or saying on error resume next and at last attach the other database. But it does not work.So I decided to use another way. I am stopping the service...Copying the files and then restarting...but i have problem in starting the database...I gives me an error saying "The server is already connected"my code is Set oSvroot = CreateObject("SQLDMO.SQLServer")oSvroot.LoginSecure = trueoSvroot.Connect "localhost"oSvroot.stop...copying the database files oSvroot.start false,"(local)"But it is not able to start the service...it says the server is already connected..I am very desperate for a solution,...it is very urgent...Please somebody help mesmita |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-03-06 : 12:55:39
|
| It would be a lot more helpful for us if you explained what you're trying to accomplish (the whole process, not just detaching and attaching a database), and why you're using SQL-DMO to do it. There are other means available to perform these tasks, many of them not requiring DMO or even VB/C++ (they can all be done using T-SQL, for example) and they might be better suited for you. |
 |
|
|
|
|
|