Hi all
I use this code to bak up database
and its working fine but i want run this code via ASP
can anyone write it for me in ASP format?
USE master
EXEC sp_addumpdevice 'disk', 'test_2',
'C:\test_2.dat'
USE master
EXEC sp_addumpdevice 'disk', 'testlog',
'C:\testlog.dat'
BACKUP DATABASE test TO test_2
BACKUP LOG test TO testlog
thanksAll you need to do is put each TSQL command as relevant ASP command.
In your case, you need to execute 4 commands so you would need
SQLStmt, SQLstmt1,2,3 and 4 lots of RS = Connection.Execute(SQLStmt)
e.g. - example of one connection & execution :
Dim UID
Dim SQLStmt, SQLStmt1, SQLStmt2, SQLStmt3
Dim Connection,
Dim RS, RS1, RS2, RS3
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open "PROVIDER=SQLOLEDB;DATA SOURCE=server1;UID=test;PWD=password;DATABASE=data base1"
SQLStmt = "SELECT * FROM TBL_Test where server_name = 'SERVER1' and job_run_time > (getdate() - 7)"
Set RS = Connection.Execute(SQLStmt)
No comments:
Post a Comment