<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE>&nbsp;</TITLE> <meta http-equiv="Content-Type" content="text/html; charset="> </HEAD> <BODY> <pre> if not exists (select * from master.dbo.syslogins where loginname = N'RECustom') BEGIN declare @logindb nvarchar(132), @loginlang nvarchar(132) select @logindb = N'RE7_SAMPLE', @loginlang = N'us_english' if @logindb is null or not exists (select * from master.dbo.sysdatabases where name = @logindb) select @logindb = N'master' if @loginlang is null or (not exists (select * from master.dbo.syslanguages where name = @loginlang) and @loginlang <> N'us_english') select @loginlang = @@language exec sp_addlogin N'RECustom', 'Password', @logindb, @loginlang END GO if not exists (select * from dbo.sysusers where name = N'RECustom' and uid < 16382) EXEC sp_grantdbaccess N'RECustom', N'RECustom' GO exec sp_addrolemember N'db_owner', N'RECustom' GO </pre> </BODY> </HTML>