Friday, October 29, 2010

How to create Logins, Users, Schemas and Database Roles

CREATE LOGIN [Hello.org] WITH PASSWORD=N' Ñèw?qÉSyDÿ8?s ! Mån¯;Ì®3¡y¹ ? ', DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=ON
GO

ALTER LOGIN [Hello.org] DISABLE
GO


-------------------------------------------------------------

CREATE LOGIN [Hello.org_Shop] WITH PASSWORD=N'B2+ó ð?;aMÈb ÿ±il®¡ÇùÍ áLçÒ?A: ¡', DEFAULT_DATABASE=[master],
DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=ON
GO

ALTER LOGIN [Hello.org_Shop] DISABLE
GO

---------------------------------------------------------------------------



CREATE USER [Hello.org] FOR LOGIN [Hello.org] WITH DEFAULT_SCHEMA=[Hello.org_SP]
GO
-------------------------------------------------------------------------

CREATE USER [Hello.org_Shop] FOR LOGIN [Hello.org_Shop] WITH DEFAULT_SCHEMA=[Hello.org_ShopSP]
GO


-------------------------------------------------------------------------------------------------------------------------

CREATE SCHEMA [Hello.org_SP] AUTHORIZATION [dbo]
GO

CREATE SCHEMA [Hello.org_ShopSP] AUTHORIZATION [dbo]
GO


CREATE SCHEMA [Hello.org_InternalSP] AUTHORIZATION [dbo]
GO


---------------------------------------------------------------------------------------------------------------

CREATE ROLE [DBR_Hello.org] AUTHORIZATION [dbo]
GO


CREATE ROLE [DBR_Hello.org_Shop] AUTHORIZATION [dbo]
GO

No comments: