views:

118

answers:

3

We have an application that has 1000+ databases and 600+ sprocs. Each database represents a different client.

Problem: We need to move this to a single database while creating as little effect on the ui as possible, meaning dont change all the sproc signatures at 1 time.

The connection string currently sets the database attribute, a proposal is to move that to the user attribute. This attribute (using SYSTEM_USER) could be used to determine the site identifier which would be used on the where clause.

The above would not be final solution, but allows us to make changes to the sproc signature at a slow controlled pace. Once all are done we can correct the connstring and get some connection pooling.

Are there any limitation to the number of logins/users that we can have on sqlserver 2005/8. Or has anyone been down this path that could shed some light on a better option.

+1  A: 

See my answer here http://stackoverflow.com/questions/632251/ideas-for-combining-thousand-databases-into-one-database/632319#632319

Sounds like you two are working the same project. YOu will need to change every proc before you can move to one datbase or each client will see the others' data.

HLGEM
how did you guess.
Thad
No, if you put the data into separate schemas - one per customer - and apply proper permissioning, the customer will *NOT* see each others data.
marc_s
I'm not sure that schemas will help. In the combined database there's one set of tables and a site identifier column showing who each row belongs to, rather than several tables that each belong to one customer.
stevemegson
Ah ok - well, in that case you could probably design views per customer, and restrict access to those views and prohibit access to the underlying base table.
marc_s
A: 

As for the number of logins on SQL Server 2005 / 08 - I don't think anyone has ever run into a hard limit here. A few thousand will NOT be any problem at all.

What you could consider for this scenario might be one schema inside your single DB per customer, e.g. customer "Miller" has a "miller" schema, with its objects inside, and customer "Brown" will have a "brown" schema.

And contrary to what HLGEM just responded - no, customers won't see each others data, if you specify proper permissions - each customer (and its users) into its own schema only - should work just fine.

Marc

marc_s
A: 

You might also consider setting a distinctive application name in the connection string rather than using a distinctive user, which you can get into your where clause using APP_NAME(). I'm sure that SQL Server won't have a problem with thousands of logins, but you may prefer not to have to create them.

stevemegson