I'm fairly new to both ASP and SQL Server 2000, but heres my problem. I have a developer PC which is not on our network, I have SQL Server installed on this machine. I want to be able to Detach the SQL database files (.mdf & .ldf) and then copy them to a CD-RW, move them to my networked PC and then have my ASP script run the SQL attach stored procedure to re-attach the database. (note: I do not have SQL Server installed on my network PC, nor do I have administrator rights, just basic user rights which is why I need to use ASP to run the stored procedure remotely) Here what I'm thinking I should use:
[blue]
<%
Dim objConn, objDBConn, objCmd, rs, strSQL, strServer, strUID, strPWD
set objConn = Server.CreateObject("ADODB.Connection"
strServer = Application("WebApps"
strUID = Application("Webuser"
strPWD = Application("Webuser"
objDBConn= "DRIVER={SQL Server};SERVER=" & strServer & ";UID=" & strUID & ";PWD=" & strPWD
objConn.Open objDBConn
[red]'** THIS IS WHERE I'M LOST HOW CAN I RUN THE BELOW T-SQL COMMAND FROM ASP?[/red]
[green]EXEC sp_attach_db @dbname = 'Test',
@filename1 = 'C:\TempData\Data\Test_data.mdf',
@filename2 = 'C:\TempData\Data\Test_log.ldf'[/green]
Set rs = objCmd.Execute
set objCmd = nothing
%>[/blue]
Bill
[blue]
<%
Dim objConn, objDBConn, objCmd, rs, strSQL, strServer, strUID, strPWD
set objConn = Server.CreateObject("ADODB.Connection"
strServer = Application("WebApps"
strUID = Application("Webuser"
strPWD = Application("Webuser"
objDBConn= "DRIVER={SQL Server};SERVER=" & strServer & ";UID=" & strUID & ";PWD=" & strPWD
objConn.Open objDBConn
[red]'** THIS IS WHERE I'M LOST HOW CAN I RUN THE BELOW T-SQL COMMAND FROM ASP?[/red]
[green]EXEC sp_attach_db @dbname = 'Test',
@filename1 = 'C:\TempData\Data\Test_data.mdf',
@filename2 = 'C:\TempData\Data\Test_log.ldf'[/green]
Set rs = objCmd.Execute
set objCmd = nothing
%>[/blue]
Bill