Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 9th, 2007, 03:21 PM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default which privilege for creating a db and tables?

Hi,

I use sql server 2005 express with Studio Management express.

Each windows-account in the domain in our organization who starts the application creates automatically (in code-behnd) first his own databaae (with as name his unique number in the organization), then several tables.

This happens only the first time he starts the application. So each member has his own database and tables.

We use IIS 5.1, so the account which runs under asp.net is ASPNET.

My question is: which privileges do i have to give to 'ASPNET' in order to create databases and tables and how to do that in Studio Management? I tried with db_reader and db_writer, but this is obviously not enough.

Another aspect is: how to protect each database from all other users, because there all are created with ASPNET. But Remote Connection is set to Local and the users reach their db via aspx pages, so i don't think it's a real issue ..

Thanks for help and other suggestions.
H.

Thanks



 
Old July 9th, 2007, 09:09 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I would imagine that the user needs some reasonably high privileges to create a database. Creating objects in the database itself should only require DBO access, but first you need to create the DB.

However, this design screams maintenance nightmare! Do you have a compelling reason to use a separate database for each user? Why not make the tables in a single database have a user identification field in them to separate the user's data?

-Peter
 
Old July 10th, 2007, 12:07 PM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, thanks for replying.

The application runs surveys. Each user can create his own survey and collect the results. That's why when a user starts the application, the application first create a database, then some tables. This happens only the first time. It's easier, i think, to work like this instead of one database with a multitude of tables in it.

But i need to know which privileges to give to ASPNET for creating the databases.

 
Old July 10th, 2007, 02:55 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

There is sql server role called "dbcreator". I would venture a guess that would work.

Why would you need a multitude of tables? (And how technically would that be different then a multitude of databases?) All you need is design your tables with a user id field. You don't need any more tables that what you have, they just need to be designed to accommodate multiple users.

-Peter
 
Old July 11th, 2007, 12:44 PM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, thanks

 
Old July 11th, 2007, 04:04 PM
Authorized User
 
Join Date: Mar 2004
Posts: 74
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would go for a single database and create user's survey entry in a table that would uniquely identify each user. Creating different databases, different tables for each user in the system would defeat the purpose of relational databases.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Tables in RichTextBox katsarosj Pro VB.NET 2002/2003 13 March 14th, 2014 05:50 AM
Creating tables on the fly Keith Smith Access VBA 1 January 15th, 2008 10:49 AM
creating tables within tables in access??? carswelljr Access 3 August 23rd, 2006 01:21 PM
Help creating tables racin_vegas PHP How-To 1 January 19th, 2006 09:11 AM
Creating Tables Programmatically stu9820 ASP.NET 1.0 and 1.1 Basics 10 October 22nd, 2003 04:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.