user2586856
user2586856

Reputation:

Access SQL Server database without SQL Server service

My C# .NET (4.5.2) application accesses a local SQL Server (13.0.1601) database.

For data archival purposes my client wants to pack a snapshot of the program and the database in a folder to run the old state when needed.

How can this be achieved with no running SQL Server service but only the folder contents and an installed .NET runtime?

Options considered so far are exporting the database to .bak or .csv and putting them in the folder, but those seem to involve a lot of manual labor.

Upvotes: 0

Views: 171

Answers (3)

slugster
slugster

Reputation: 49984

As mentioned in the comments by marc, you need to have a SQL instance running to use a backup file.

Exporting it to a .bak file is not a "lot of work" - it just involves logging in to the SQL Server (from the application) and issuing the right SQL commands.

But in order to view this again you will have to re-import it back into a SQL instance - this is the reverse of the step above (although obviously you will have to rename it because your original database will still be resident in the SQL instance).

If you are looking to avoid having a SQL instance (service) installed then maybe SQL Server Express LocalDB is an option for you - it runs totally in memory.

Upvotes: 1

cynic
cynic

Reputation: 5405

There is no embedded version of SQL Server. The closest thing is the LocalDB feature available since the 2012 version - it does require installation of some SQL Server components but does not require running a service. With it installed, you'd attach the MDF and LDF files (read-only if necessary) of the snapshot.

Upvotes: 0

user4843530
user4843530

Reputation:

You could create a script to export the tables as CSV and modify the program to use q to run its sql queries directly to those CSV files.

Upvotes: 0

Related Questions