Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. backing up/moving mssql databases

backing up/moving mssql databases

Scheduled Pinned Locked Moved Database
databasesql-serversysadminhelpquestion
7 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    djkno3
    wrote on last edited by
    #1

    Is there anyway (using msde) to backup a database from a mssql 2000 server? or any program, code etc. I would like to back up my database off my website localy onto my own computer (Just in case anything happens or I move providers). Thanks for any help you can provide.

    M 1 Reply Last reply
    0
    • D djkno3

      Is there anyway (using msde) to backup a database from a mssql 2000 server? or any program, code etc. I would like to back up my database off my website localy onto my own computer (Just in case anything happens or I move providers). Thanks for any help you can provide.

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      BACKUP DATABASE[^].

      D 1 Reply Last reply
      0
      • M Mike Dimmick

        BACKUP DATABASE[^].

        D Offline
        D Offline
        djkno3
        wrote on last edited by
        #3

        thanks :) so I run this as a nonquery?

        D 1 Reply Last reply
        0
        • D djkno3

          thanks :) so I run this as a nonquery?

          D Offline
          D Offline
          djkno3
          wrote on last edited by
          #4

          I keep getting an error about an "Unrecognized escape sequence" this is the line SqlCommand cmd1 = new SqlCommand("EXEC sp_addumpdevice 'disk','databasedump','C:\temp\database.dat") What am I doing wrong?

          M 1 Reply Last reply
          0
          • D djkno3

            I keep getting an error about an "Unrecognized escape sequence" this is the line SqlCommand cmd1 = new SqlCommand("EXEC sp_addumpdevice 'disk','databasedump','C:\temp\database.dat") What am I doing wrong?

            M Offline
            M Offline
            Mike Dimmick
            wrote on last edited by
            #5

            If you're using C#, you need to either prefix the string with @, or you need to double the backslash characters - the \ character begins a special character combination in all C-based languages. See the documentation for string[^] or the specification for string literals[^] (although this is probably too much detail!) Specifically, the '\t' will be interpreted as a TAB character and '\d' is causing the error you mention (since this is not a valid escape). You also appear to be missing a single-quote mark to close the last string parameter.

            D 1 Reply Last reply
            0
            • M Mike Dimmick

              If you're using C#, you need to either prefix the string with @, or you need to double the backslash characters - the \ character begins a special character combination in all C-based languages. See the documentation for string[^] or the specification for string literals[^] (although this is probably too much detail!) Specifically, the '\t' will be interpreted as a TAB character and '\d' is causing the error you mention (since this is not a valid escape). You also appear to be missing a single-quote mark to close the last string parameter.

              D Offline
              D Offline
              djkno3
              wrote on last edited by
              #6

              ok I thought that's what it was but I got sidetracked on another project and never had time for it untill today (what good timing huh ;)) I am trying to do the backup command you showed me and I am delaring them like this SqlCommand cmd1 = new SqlCommand("EXEC sp_addumpdevice 'disk','localBackup','C:\\temp\\database.dat'",sqlConnection1); SqlCommand cmd2 = new SqlCommand("BACKUP DATABASE databaseName TO localBackup",sqlConnection1); I am calling them from within this try block try { cmd1.ExecuteNonQuery(); cmd2.ExecuteNonQuery(); //sqlBackup.Commit(); tbError.Text = "Finished"; } and running them as non queries (I tried them as transactions but it gave me this error "The procedure 'sp_addumpdevice' cannot be executed within a transaction") so I took them out and make them queries and now I get a problem with the Execute command saying I need a transaction property. "Execute requires the command to have a transaction object when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized." Now I am really confused :(

              M 1 Reply Last reply
              0
              • D djkno3

                ok I thought that's what it was but I got sidetracked on another project and never had time for it untill today (what good timing huh ;)) I am trying to do the backup command you showed me and I am delaring them like this SqlCommand cmd1 = new SqlCommand("EXEC sp_addumpdevice 'disk','localBackup','C:\\temp\\database.dat'",sqlConnection1); SqlCommand cmd2 = new SqlCommand("BACKUP DATABASE databaseName TO localBackup",sqlConnection1); I am calling them from within this try block try { cmd1.ExecuteNonQuery(); cmd2.ExecuteNonQuery(); //sqlBackup.Commit(); tbError.Text = "Finished"; } and running them as non queries (I tried them as transactions but it gave me this error "The procedure 'sp_addumpdevice' cannot be executed within a transaction") so I took them out and make them queries and now I get a problem with the Execute command saying I need a transaction property. "Execute requires the command to have a transaction object when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized." Now I am really confused :(

                M Offline
                M Offline
                Mike Dimmick
                wrote on last edited by
                #7

                I suspect you've still got a BeginTransaction call outstanding on the sqlConnection1 object.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups