Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Database Design - One Database or Multiple Databases

Posted on 2006-07-13
10
Medium Priority
?
375 Views
Last Modified: 2011-04-14
I'm designing a ASP .NET application where multiple companies will access it.  These companies need to see only thier data and not everyone elses.  Would it be best to create a new database for each company, or create one database with a COMPANYID field in each table?
0
Comment
Question by:valrog
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 11

Assisted Solution

by:Ved Prakash Agrawal
Ved Prakash Agrawal earned 500 total points
ID: 17099643
it is difficult to maintain mutiple data base for different client.

so i think you should use one database with companyID .


0
 
LVL 11

Expert Comment

by:Ved Prakash Agrawal
ID: 17099657

if use use single database means you can share many master table which have static data for all client.
0
 
LVL 13

Accepted Solution

by:
devsolns earned 500 total points
ID: 17099664
For this type of design I would not have a different database for each company.  This makes maintenance hard, and schema changes even harder to synchronize.  I would suggest you create a unique id or GUID for each company and reference all of data by that ID.

You could also create a new user (login) for each company and have all references to SUSER_SNAME(), which will return the current logged in user.

Hope this helps.

--DS
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 13

Expert Comment

by:devsolns
ID: 17099679
A link for the row level security is here:

http://vyaskn.tripod.com/row_level_security_in_sql_server_databases.htm

--DS
0
 
LVL 27

Assisted Solution

by:ptjcb
ptjcb earned 500 total points
ID: 17099860
Yes, we are moving from a multiple db setup where all of the database structures are alike to a single db with an id to separate the clients. Trust me, maintaining and trying to keep many databases in sync with exactly the same structure is a pain. Updates have to be applied in a certain order, based on the client, and then some clients will want flexibility. Periodic data updates to the common tables may take a day to do.

Move to one db.
0
 
LVL 10

Assisted Solution

by:RichardCorrie
RichardCorrie earned 500 total points
ID: 17099895
I have done both;

In the long run having a different DB for each client is an "easier" sell. Clients tend not to want to have their data mixed up with other companies.  In multi-db sceanarios I have created a central DB that holds common tables and system values.

I has also allowed for easier "client" modifications.  It is v. strange fact that no 2 companies (event within the same industry) do their business the same way; they all require little tweaks and enhancements.

/Richard
0
 
LVL 3

Author Comment

by:valrog
ID: 17099915
RichardCorrie, If I go with your scenario, how many DB can SQL Server 2005 handle at once?
0
 
LVL 13

Expert Comment

by:devsolns
ID: 17100083
SQL Server max databases per instance is 32,767
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 17101008
If you do go with a database for each client, you should invest in a tool such as the following to keep the databases in sync (it will save you time, hair on your head and maybe even your job):
SQL Compare® Standard
Compares and synchronizes SQL Server database schemas
http://www.red-gate.com/products/sql_compare/index.htm

And optionally:
SQL Data Compare™ Standard
Compares and synchronizes SQL database contents
http://www.red-gate.com/products/SQL_Data_Compare/index.htm
0
 
LVL 3

Author Comment

by:valrog
ID: 17101110
Thanks for the software recommendation acperkins.  It would do me good if I still had much hair.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question