USE [arrdbdbname]
GO

/****** Object:  User [arr]    Script Date: 5/30/2019 3:33:47 PM ******/
DROP USER [arr]
GO


USE [pacsdbdbname]
GO

/****** Object:  User [pacs]    Script Date: 5/30/2019 3:48:46 PM ******/
DROP USER [pacs]
GO

USE [master]
GO
/* For security reasons the login is created disabled and with a random password. */
/****** Object:  Login [arr]    Script Date: 5/28/2019 3:46:54 PM ******/
CREATE LOGIN [user_arrdbdbname] WITH PASSWORD=N'userpass', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
ALTER LOGIN [user_arrdbdbname] ENABLE

--Them quyen user cho db arrdb
USE [arrdbdbname]
GO

CREATE USER [user_arrdbdbname] FOR LOGIN [user_arrdbdbname]
GO

ALTER ROLE [db_datareader] ADD MEMBER [user_arrdbdbname] 
GO

ALTER ROLE [db_datawriter] ADD MEMBER [user_arrdbdbname]
GO

ALTER ROLE [db_owner] ADD MEMBER [user_arrdbdbname]
GO

USE [master]
GO
/* For security reasons the login is created disabled and with a random password. */
/****** Object:  Login [user_pacsdbdbname]    Script Date: 5/28/2019 3:47:39 PM ******/
CREATE LOGIN [user_pacsdbdbname] WITH PASSWORD=N'userpass', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
ALTER LOGIN [user_pacsdbdbname] ENABLE

GO
-- Them quyen user cho db pacsdb
USE [pacsdbdbname]
GO

CREATE USER [user_pacsdbdbname] FOR LOGIN [user_pacsdbdbname]
GO

ALTER ROLE [db_datareader] ADD MEMBER [user_pacsdbdbname]
GO

ALTER ROLE [db_datawriter] ADD MEMBER [user_pacsdbdbname]
GO

ALTER ROLE [db_owner] ADD MEMBER [user_pacsdbdbname]
GO
