4 Replies - 8819 Views - Last Post: 30 August 2012 - 05:30 PM

How to use MS Sql server Database file without sql server?

Posted 29 August 2012 - 12:01 PM

hi guys, the header of the question doesnt describe what i want. Recently i made a library management system on visual studio 2010 in c#. and with it i attach sql server with it for database.
i deployed my software and made exe and installed it. now if i want to give this software to someone else to use it, and that person doesnt have sql server installed on his machine. is there any way there i just give him a db file with software and the software will perform all the operation with this file instead of using sql server as db. or everyone who wants to use my software,should have sql server installed??? I hope i made myself clear!!!

Re: How to use MS Sql server Database file without sql server?

Posted 29 August 2012 - 12:33 PM

You could redesign the app to use SQL Server Compact. It works much like it's big brother, the SQL Server itself, but it connects to a file rather than a server. The file can then be moved to another computer and used there, without having to set anything else up on that computer. (Except the app itself, obviously.)

Re: How to use MS Sql server Database file without sql server?

In all my years as a DBA, I think I'm aware of one person who I heard was using the Compact Edition. I thought it was pretty much a local copy of SQL Sever with a drastically cut down feature set.

The first thing you have to be aware of is that SQL Server is a bare minimum of 6 files. That's without a server. There are three databases involved just to say you have the database. The Master database is the core of the server and half of your security accounts. You can't access the database without because the server logins are in the master database. The TempDB database is also pretty much a requirement. It gets recreated every time you start the server. So "theoretically" there's nothing in there you can't do without, but SQL Server itself tends to use it and your code may use it. I assume that you have no scheduled jobs, which would be the MSDB database. Without it all your jobs and scheduling are gone. Model you can basically do without. It's mostly just a template for new databases you are creating. There's also the hidden database introduced in SQL 2005. I can't remember what's in there since I haven't had to deal with it in years. All of this is before you even get to your database. Every database has an absolute minimum of two files, the .MDF and the .LDF. No database will function without both files, although technically you could probably reattach the .MDF and get it to create a new .LDF (this is an extremly bad idea, but it can be done as a last ditch effort). So for master and your database that's an absolute minimum of 4 files, not counting any of the other system databases that I just mentioned, which are required for a fully functional SQL Server.

You might get what you want from a cut down version of SQL Server, such as Compact or Express edition. But otherwise, you'll end up recreating SQL Server before you have enough functionality to properly make use of those files.

I would check out the Compact edition, like mentioned. Also, maybe consider the Express edition which offers similar functionality to the Standard edition of SQL Server.

Re: How to use MS Sql server Database file without sql server?

Posted 30 August 2012 - 05:30 PM

This is probably stupid and I've Google'd it too, just want to hear someone's perspective over here, are there no licensing restrictions for Express? Does that mean I can bundle it with any apps I choose to create?