Can LinqPad connect to an mdf file? - linqpad

Can LinqPad query from a loose mdf file? How would it happen?
(Joe Albahari, are you out there?)

Yes. Choose Linq to SQL. Then there's Attach Database File.

Related

vb.net + Convert a SQL database to a DBF database without provider, using text file

I work with vb.net
I have a sqlServer database and i need to migrate to a DBF database.
I know that a dbf file sctructure is a hexadecimal text file.
I want to generate this file without a provider...building this file with this hexadecimal structure.
Somebody here already did it???
I hope you undestand what i said.
Thanks by the attention.
Since you have SQl Server I would use SSIS to do the task. You can directly create a dBase file using an ODBC connection. Although why anyone would want to go back to dBase when they already have a SQl Server database is a mystery to me.

Scripting Database schema

I have a database in my sql management studio how can script the database schema to file so that I can put it in another device?
thanks
Open SQL Management -> Script Database As -> .... I think its the closest to what you mean.
Of course there are 3rd party tools for these kind of works. See RedGate.
Shutdown SQL Server, copy the MDF and LDF Files to a new server and attach them on that instance by right clicking on Databases and choosing Attach. Specify the location of the files.
Alternatively, you could also backup the database from the source and restore it in the destination.
The above two methods copy all data too. If you want only the schema, Right click on the database and choose Generate SQL Scripts and follow the instructions.
SQL Management Studio 2008 can make query to unload Schema and data from database, but older versions if Management studio can't do it. You can use another soft to do it like an EMS SQL Management studio

SQL Server MDF file

I am working on a website that has access data from a database (sql server). It will also be adding, updating deleting records in the database. It seems like there is an MDF file that gets created containing the database schema and all the records I guess? Once development is complete and I want to move this database to a real server then all I need to do is move this MDF file to the real server and that is it? is it that simple? or not really?
Also, I hope the MDF file is not a read-only file and can be updated/modified or is it?
Yes, the MDF data file (and the associated *.LDF transaction log file) contains all the database objects that make up your system.
And yes, you can definitely detach a database (an .MDF/.LDF file pair) from your (dev) SQL Server, copy it onto another "real" Production SQL Server, and re-attach it there, without loss of data or information.
Yes, the MDF file is modifyable - through the SQL Server commands and methods. You should never tamper with the file yourself, directly (flipping bits). Use SQL Server and its official interfaces (T-SQL, ADO.NET etc.) to work with your data.
Yes you can do that. Right click the database and click "detach". Make sure you click the drop connections box and click ok (if you don't do this some errors could occur). You can now move the mdf and ldf files.
However, there is a better way imho. Instead, create a full backup of the database, copy the backup file, and restore from the backup on the new server. Now you have two copies of the database, a development version and a production version.
You will need to take .MDF file as well as .LDF file which will have your logs. You have to take both mdf and ldf files and attach on the real server.

Cant read .bak files

I wanted to read .bak files that are the backup files of my ms sql database.Now I am wodering how to read these files using Sql Mngmnt studio. Please help me out .Thanks
You can restore the .BAK file to a temporary database using SQL Management Studio and read them!
Some pointers here
you can restore the .bak file.there you get all the datas

How to convert a database file (.sql) to a .mdf file?

I have a database that was given to me, but is in a file format (.sql). I want to open it in my SQL Server, but I don't know how, because it says i need a .mdf file?
Can someone help?
Open up the .sql file - if it contains SQL code in plain text, you have most likely received the database as a create script. Run it in SQL Server Management Studio.
A .sql file is (usually) just a series of SQL commands that you execute on the SQL server using your preferred GUI or CLI. Try opening it in Notepad to see what I mean.
Click on the data base.
Right click displays drop down menu.
Select execute SQL file.
Search for your .SQL file
Click on start button
Click close.
Press F5.
.Sql file is just a random file holding some SQL queries. While .mdf and .ldf are Microsoft SQL Server Database files which hold an entire database.
Run your file in SQL Server Management Studio.