Tuesday, May 3, 2011

Creating an account to access SQL Server

We've created a set of custom views on our CLICK 5.6 database which are used for reporting.  To access them we  needed simple production account:


Creating production accounts -
- make sure it doesn't exist
- create account
- assign it a user name
- give it limited security rights
- give it the right to connect

IF NOT EXISTS ( SELECT  *
                FROM    master.dbo.syslogins
                WHERE   loginname = N'ZZBSTN\dsq-apps' ) 
    CREATE LOGIN [CHBSTN\dsq-apps] FROM WINDOWS
CREATE USER [dsq-Apps] FOR LOGIN [ZZBSTN\dsq-apps]
GO


GRANT REFERENCES ON  [dbo].[v_Person] TO [dsq-Apps]
GRANT SELECT ON  [dbo].[v_Person] TO [dsq-Apps]
GRANT REFERENCES ON  [dbo].[v_PersonTraining] TO [dsq-Apps]
GRANT SELECT ON  [dbo].[v_PersonTraining] TO [dsq-Apps]
GRANT CONNECT TO [dsq-Apps]
GO

No comments:

Post a Comment