use [qwoss]
GO

if not exists (select * from master.dbo.syslogins where loginname = N'qwoss')
BEGIN
        declare @logindb nvarchar(132), @loginlang nvarchar(132) select @logindb = N'qwoss', @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'qwoss', N'qwoss', @logindb, @loginlang
END
GO

if not exists (select * from dbo.sysusers where name = N'qwoss' and uid < 16382)
        EXEC sp_grantdbaccess N'qwoss', N'qwoss'
GO

exec sp_addrolemember N'db_owner', N'qwoss'
GO

