Results 1 to 2 of 2

Thread: BackUp database

  1. #1
    Join Date
    May 2004
    Location
    Dubai
    Posts
    40

    Unanswered: BackUp database

    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?



    Code:
    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



    thanks

  2. #2
    Join Date
    May 2003
    Location
    UK
    Posts
    220
    All 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)
    Last edited by sqlguy7777; 11-28-04 at 21:28.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •