Hi
I may have repeated this question . I want to create New Database & attach existing file to it . How it can be done.
I have written the below Code it gives message file already exists
Set myConn = New ADODB.Connection
myConn.ConnectionString = "Provider = sqloledb;Data Source=" & ServerName & ";uid=" & uid & ";pwd=" & pwd
str = "CREATE DATABASE MyDatabase ON PRIMARY " & _
"(NAME = MyDatabase_Data, " & _
" FILENAME = 'E:\test1.mdf', " & _
" SIZE = 2MB, " & _
" MAXSIZE = 10MB, " & _
" FILEGROWTH = 10%) " & _
" LOG ON " & _
"(NAME = MyDatabase_Log, " & _
" FILENAME = 'E:\test1.ldf', " & _
" SIZE = 1MB, " & _
" MAXSIZE = 5MB, " & _
" FILEGROWTH = 10%) "
myConn.Open
myConn.Execute (str)
Thanks
I may have repeated this question . I want to create New Database & attach existing file to it . How it can be done.
I have written the below Code it gives message file already exists
Set myConn = New ADODB.Connection
myConn.ConnectionString = "Provider = sqloledb;Data Source=" & ServerName & ";uid=" & uid & ";pwd=" & pwd
str = "CREATE DATABASE MyDatabase ON PRIMARY " & _
"(NAME = MyDatabase_Data, " & _
" FILENAME = 'E:\test1.mdf', " & _
" SIZE = 2MB, " & _
" MAXSIZE = 10MB, " & _
" FILEGROWTH = 10%) " & _
" LOG ON " & _
"(NAME = MyDatabase_Log, " & _
" FILENAME = 'E:\test1.ldf', " & _
" SIZE = 1MB, " & _
" MAXSIZE = 5MB, " & _
" FILEGROWTH = 10%) "
myConn.Open
myConn.Execute (str)
Thanks