Hi Tony,
To restore the Database what you can do is take a backup of existing DB and
restore it with a different name.
This way you will have a copy of DB.
here is the sampe script to do this.
RESTORE DATABASE TaxReconDB_Prod
FROM DISK = 'D:\Tax\BackUp\TaxReconDB.dmp'
WITH MOVE 'TaxReconDB_Data' TO
'D:\Database\NJROS1D151DEV\MSSQL$NJROS1D151DEV\Data\TaxReconDB_Prod_Data.MDF
'
, MOVE 'TaxReconDB_Log' TO
'D:\Database\NJROS1D151DEV\MSSQL$NJROS1D151DEV\Data\TaxReconDB_Prod_Log.LDF'
, REPLACE
This works fine.Since i have used this in one of my project.
There is no need to run in Command line.(i guess u are thing of using isql
utility and point it to .sql file which contains the Scripts )
Thanks
Raghavendra
[quoted text, click to view] "tony" <itdong@hotmail.com> wrote in message
news:O7qQXariEHA.3548@TK2MSFTNGP09.phx.gbl...
> Hi Raghavendra
>
> Thank you for your information, and you are right, It is a MS SQL server
> copy, so first I use sp_detech_db to detech the database (like you
said,same
> stop sql server) , and then make a copy, it is not only backup database,
but
> is make an absolute copy and save back in same SQL server with other
> database name, it is dynamic copy, I only give the database name and let
> vb.net make a total new copy with data,view,stored procedure, role ect
> inside. I must use program to do it, it is required.
>
> Do you have mre suggestion about that?
> Do I have to run at command line to make a copy in vb.net?
>
> Thanks
>
> Tony
> "Raghavendra T V" <raagzvb@hotmail.com> wrote in message
> news:ua5xsbpiEHA.4092@TK2MSFTNGP10.phx.gbl...
> > Hi Tony,
> >
> > You are trying to copy the .ldf files which are used by MS SQL server.
> > You need to stop the MS SQL server on your machine which is running.
> > Only then you will be able to copy it.
> >
> > I guess you are trying to take a backup of the MS SQL Database through
> > VB.NET code.
> > I would suggest you to make use of BACKUP DATABASE SQL command .
> >
> > Thanks
> > Raghavendra
> > "tony" <itdong@hotmail.com> wrote in message
> > news:OWooXeViEHA.3608@TK2MSFTNGP09.phx.gbl...
> > > Hi there
> > >
> > > when I want to copy a large file(>64K), I got error as follow:
> > >
> > > the process cannot access the file, because it is being used by other
> > > process
> > >
> > > this is my code as follow
> > > Try
> > > File.Copy("C:\Program Files\Microsoft SQL
> > > Server\MSSQL\Data\test.LDF", "C:\Program Files\Microsoft SQL
> > > Server\MSSQL\Data\TEST2.LDF")
> > > MessageBox.Show("OK")
> > >
> > > Catch ex As Exception
> > >
> > > MessageBox.Show("Error:" & ex.Message)
> > > End Try
> > >
> > > Thanks for any helpful.
> > >
> > > Tony
> > >
> > >
> >
> >
>
>