backup & restore of sqlsever database to any disk

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Parameswar Nayak
    New Member
    • Jul 2010
    • 7

    backup & restore of sqlsever database to any disk

    I am using sqlserver 2005 in my win application.I need to take backup of my database to any disk.I have tried a lot bt an exception is raised.

    "Could not locate entry in sysdatabases for database 'JmAccount.mdf' . No entry found with that name. Make sure that the name is entered correctly.
    BACKUP DATABASE is terminating abnormally."

    My connection string is like
    ........
    con = new SqlConnection(@ "Data Source=.\SQLEXP RESS;AttachDbFi lename=D:\Accou ntData\JmAccoun t.mdf;Integrate d Security=True;C onnect Timeout=30;User Instance=True") ;

    I need to take the JmAccount database to take as backup to any location in disk.
  • Jerry Winston
    Recognized Expert New Member
    • Jun 2008
    • 145

    #2
    Have you run this?
    Code:
    SELECT * FROM sys.databases
    If your database isn't named "JmAccount.mdf" . That's just the primary data file. Your database name would appear somewhere in the [name] field of the above SELECT statement. The name listed there is what you would use to BACKUP your database. Run this query to get more details about your file structure.

    Code:
    SELECT DB_NAME() as [DatabaseName],
    S.name as [DataSpace],
    F.name as [FileName],
    Physical_name as [FileLocation]
    FROM sys.database_files F
    INNER JOIN
    sys.data_spaces S
    ON
    F.data_space_id = S.data_space_id

    Comment

    Working...