Data Backup

Total Post:37

Points:259
 1874  View(s)
Ratings:
Rate this:
How to take backup of sel server 2005
  1. Post:127

    Points:915
    Re: Data Backup

    In Management Studio select database >> right click on selected database >> tasks >> back up

  1. Post:37

    Points:259
    Re: Data Backup

    I want to command

  1. Post:126

    Points:882
    Re: Data Backup

    Write down following code snippet in c# to take backup. One thing remeber that creadential should be changed..

        using System;
        using System.Data;
        using System.Collections;
    using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo;
    class Program { static void Main(string[] args) { BackupDeviceItem bdi = new BackupDeviceItem("AdventureWorks.bak", DeviceType.File);
    Backup bu = new Backup( ); bu.Database = "AdventureWorks"; bu.Devices.Add(bdi); bu.Initialize = true;
    // add percent complete and complete event handlers bu.PercentComplete += new PercentCompleteEventHandler(Backup_PercentComplete); bu.Complete +=new ServerMessageEventHandler(Backup_Complete);
    Server server = new Server("localhost"); bu.SqlBackup(server);
    Console.WriteLine(Environment.NewLine + "Press any key to continue."); Console.ReadKey( ); }
    protected static void Backup_PercentComplete( object sender, PercentCompleteEventArgs e) { Console.WriteLine(e.Percent + "% processed."); }
    protected static void Backup_Complete(object sender, ServerMessageEventArgs e) { Console.WriteLine(Environment.NewLine + e.ToString( )); } }

      Modified On Mar-29-2018 04:10:13 AM

Answer