Script de criação de usuários - SQL 2005
IF EXISTS(SELECT * FROM DBO.SYSUSERS WHERE NAME = 'SYSDBA')
EXEC sp_dropuser 'SYSDBA'
GO
IF EXISTS(SELECT * FROM DBO.SYSUSERS WHERE NAME = '\SYSDBA')
EXEC sp_dropuser 'SYSDBA'
GO
IF EXISTS(SELECT * FROM DBO.SYSUSERS WHERE NAME = 'sysdba')
EXEC sp_dropuser 'sysdba'
GO
IF EXISTS(SELECT * FROM DBO.SYSUSERS WHERE NAME = '\sysdba')
EXEC sp_dropuser 'sysdba'
GO
IF EXISTS(SELECT * FROM DBO.SYSUSERS WHERE NAME = '\rm')
EXEC sp_dropalias 'rm'
GO
IF EXISTS(SELECT * FROM DBO.SYSUSERS WHERE NAME = '\RM')
EXEC sp_dropalias 'RM'
GO
IF EXISTS(SELECT * FROM DBO.SYSUSERS WHERE NAME = '\RM')
EXEC sp_dropalias '\RM'
GO
IF NOT EXISTS(SELECT * FROM MASTER.DBO.SYSLOGINS WHERE NAME = 'rm')
CREATE LOGIN rm WITH PASSWORD = 'rm',CHECK_POLICY=OFF
GO
EXEC sp_addalias rm,dbo
GO
IF NOT EXISTS(SELECT * FROM MASTER.DBO.SYSLOGINS WHERE NAME = 'sysdba')
CREATE LOGIN sysdba WITH PASSWORD = 'masterkey',CHECK_POLICY=OFF
GO
EXEC sp_adduser sysdba,sysdba
GO
GRANT SELECT ON GPARAMS TO sysdba
GO
GRANT SELECT , UPDATE ON GUSUARIO TO sysdba
GO
GRANT SELECT ON GPERMIS TO sysdba
GO
GRANT SELECT ON GACESSO TO sysdba
GO
GRANT SELECT ON GSISTEMA TO sysdba
GO
GRANT SELECT ON GCOLIGADA TO sysdba
GO
GRANT SELECT ON GUSRPERFIL TO sysdba
GO
GRANT SELECT ON GSERVICO TO sysdba
GO