|
Posted by Erland Sommarskog on 07/16/07 22:12
Limunski Magarac (limunski_magarac@yahoo.com) writes:
> 20 MB is just a default size. Many times it's not needed to
> increase the size, but if it's necessary, I can always do it
> manually.
Ehum, in a web-host scenario, this would mean that the user would have
to call the helpdesk when his database is full. Is that a good thing?
>> > if not exists (select * from dbo.sysusers where name =
>> > N'guest' and hasdbaccess = 1)
>> > EXEC sp_grantdbaccess N'guest'
>> > GO
>>
>> Eh? Any particular reason you enable guest? Particularly at a web
>> host, I would not recommend this.
>
> Access is granted via group membership. It has 'public' role
> membership. But I'll look into this further, thanks for the
> heads-up.
I now understand even less why you enable guest.
>> > exec sp_addrolemember N'db_owner', N'magarac'
>> > GO
>>
>> Hm, wouldn't be better to make the user the owner of the database?
>
> Isn't this the exact thing this line does? Sets the user as the
> owner?
Nope. It gives the user the same privileges in the database as if
he was dbo, but he will not be dbo. This could matter in Mgmt Studio.
By default all users see all databases. The way to avoid this is to
revoke the permission VIEW ANY DATABASE from users. Then they will
only see the databases master and tempdb and any database they own.
If you are on SQL 2000, this is a little different. But there is
on the other hand the issue that the default schema for the user
will not be dbo.
> When the script is called with DBname and username, it should
> create the database and a new SQL server login (and set default
> database for this login to DBname).
>
> I'm afraid I really do not know how to script a creation of a
> new login. I've managed to go this far with scripted creation
> of database, and with your help I went even further.
Depends on which version of SQL Server you are using. On SQL 2000 you
use sp_addlogin to create a login, on SQL 2005 you use CREATE LOGIN.
Both are documented in Books Online.
By the way, on SQL 2005 the way to create a database user is CREATE USER.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|