Error opening .mdf file through SQL Server Management Studio Express - sql-server-2005

I am doing a project of a web enabled database. I have created the database file in my PC.
Now when I just want to open .mdf i.e. of the database I created, I cannot open it in other PC. I even had copied the .ldf file i.e the log file to that PC.
Since I need to transfer the database to the Server later, I don't know how I will dump the database in that server from my PC so that the company can use it.

The basics of using mdf file is like this:
Create a new database using SQL Server (set the path for the file as you wish)
If you wish to move the file elsewhere,
detach the database from your server
copy/move the file to wherever you wish
attach the file as database in SQL server
You are not supposed to open the file by double-clicking as mime setting or attachment of extensions migh not be there in the target machine.
Why don't you use the decent method to copy/move database?

Related

Creating .bak file from a .mdf without being attached in SQL Server

I have an .mdf file from SQL Server, which I need to create a .bak file from. I can't attach the database in SQL server because it seems to be corrupted and I want to try to restoring it using a .bak file.
Is there a way to create a .bak file without the .mdf file being attached in SQL Server?
Is it possible to do it via cmd line?

Unexpectedly deleted SQL File Stream Shared location

I unexpected delete SQL File Stream Shared location, is there a way to restore the Shared location. When i try to open SQL File table from SSMS Explore File Table Directory it works on Server, but it doesn't allow to open from client machine. I already enabled Remote Access for SQL File Shared. Is there a way to restore back.
Also can any one suggest me unable to open File Explorer from SSMS. it shows unauthrised access

How to attach to database on the network

I want to read mdf ldf files another PC on my network. But another PC doesnt have a SQL Server. Only have .mdf and .ldf files
I want to attach my SQL Server 2008 from network. Is it possibble?
Sure, no different than when file is local:
USE [master]
GO
CREATE DATABASE [X] ON
( FILENAME = N'\\NetworkPath\Share\X.mdf' ),
( FILENAME = N'\\NetworkPath\Share\X_log.ldf' )
FOR ATTACH
GO
Although, I would suggest copying the files to local machine if possible.
Simply you can copy the MDF file and LDF File and paste on machine location where SQL database files exists on which SQL Server running then you can attach it using SSMS.

How to import MDF/LDF DotNetNuke/WebMatrix data into SQL Server

How do I import data in the Database.mdf file into a SQL Server? I am using RazorSQL to access the MSSQL database, and tried to "import" the data, but did not know which "separator" to use.
I presume that my DotNetNuke data is in the Database.mdf file since WebMatrix was running locally and the web.config files references it.
I have an LDF file as well.
Using WebMatrix Migrate is not an option. This is a manual procedure I am looking for.
Open up SQL Server Management Studio and connect to your database server.
Then follow these steps:
Attaching a MDF file
Attaching an MDF file without LDF
This will get your database into SQL Server then you can export the data or do whatever you want with it from SQL Server management studio.

sql server 2005 (for old systems) and many problems for attach and restore...(changing drive location)

why sql server 2005 so sucks?
i should work on an old system that using sql server 2005!
my problems are :
1-when i detach a database and move mdf / ldf files of that db to another drive , so i can
not attach these files because of moving!
what is the best way for change the location of mdf/ldf files to another drive?
==============================================================================
2-when i backup a db that mdf/ldf of that db are on drive e , so i can not restore that bak file to another system that has not drive e / what is going on about sql server 2005 / i test this job on sql server 2008 and every thing was ok / how can i solve this issue?
i am using windows 7 ultimate / sql server management studio express edition /
thanks in future advance
best regards
When you restore a database backup you need to go into the restore options and update the paths of the MDF/LDF files to wherever you want them on the new machine. The default is to keep these paths the same and obviously they may not exist on the new machine.
When you did the restore, you pointed the data and log files to the new drives - you may have done this in the GUI (Management Studio) or in TSQL. When you try the reattach, you need to do the same thing - just change the file locations.
Firstly you take the backup of SQL database including Log transaction files also. Then detach it by right clicking on it. Now you can change the location of MDF file and then restore. it.