1 ETQ000 ================================================== 1 ETQ399 Executing SQL script '..\var\MSSSHDCRE.TSQL'. 2 ETQ399 Connecting to database 'mss'. 4 ETQ010 Date & Time: 20200722140408 3 ETQ398 SQL: print 'Creating Login ehi_shd' set nocount on 3 ETQ398 SQL: use master declare @passwd sysname set @passwd = 3 ETQ398XSQL: 'RAND-pwd-' + cast(abs(checksum(cast(getdate() as float)+ 3 ETQ398XSQL: rand()*1234567)) as sysname) set @passwd = @passwd + 3 ETQ398XSQL: cast(abs(checksum(cast(getdate() as float)+ rand()*1234567)) as 3 ETQ398XSQL: sysname) if not exists (select * from 3 ETQ398XSQL: master.sys.server_principals where name = N'ehi_shd') BEGIN 3 ETQ398XSQL: exec('CREATE LOGIN ehi_shd with password = ''' + @passwd + 3 ETQ398XSQL: ''', default_database = EHI, check_expiration = off, check_policy = off') 3 ETQ398XSQL: GRANT CONTROL SERVER TO ehi_shd END ELSE 3 ETQ398XSQL: BEGIN EXECUTE AS LOGIN = N'ehi_shd'; IF NOT EXISTS 3 ETQ398XSQL: (SELECT * FROM fn_my_permissions(NULL, N'SERVER') WHERE 3 ETQ398XSQL: permission_name = N'CONTROL SERVER') THROW 50001, 3 ETQ398XSQL: N'shadow login did already exist in the master database but did not have the required permissions', 3 ETQ398XSQL: 1; REVERT; END if(not exists(select name from 3 ETQ398XSQL: master.sys.database_principals where name = N'ehi_shd')) BEGIN 3 ETQ398XSQL: CREATE USER ehi_shd WITH DEFAULT_SCHEMA = ehi_shd ALTER 3 ETQ398XSQL: ROLE db_owner ADD MEMBER ehi_shd END ELSE IF NOT EXISTS 3 ETQ398XSQL: (select * from sys.database_role_members rm, sys.database_principals 3 ETQ398XSQL: roles, sys.database_principals users WHERE 3 ETQ398XSQL: rm.role_principal_id = roles.principal_id AND roles.name = N'db_owner' 3 ETQ398XSQL: AND rm.member_principal_id = users.principal_id AND users.name = 3 ETQ398XSQL: N'ehi_shd') BEGIN THROW 50001, 3 ETQ398XSQL: N'shadow user did already exist in the master database but did not have the required permissions', 3 ETQ398XSQL: 1; END 3 ETQ398 SQL: use EHI if(not exists(select name from sys.database_principals 3 ETQ398XSQL: where name = 'ehi_shd')) BEGIN CREATE USER ehi_shd WITH 3 ETQ398XSQL: DEFAULT_SCHEMA = ehi_shd ALTER ROLE db_ddladmin ADD MEMBER 3 ETQ398XSQL: ehi_shd END ELSE IF NOT EXISTS (select * from 3 ETQ398XSQL: sys.database_role_members rm, sys.database_principals roles, 3 ETQ398XSQL: sys.database_principals users WHERE rm.role_principal_id = 3 ETQ398XSQL: roles.principal_id AND roles.name = N'db_ddladmin' AND 3 ETQ398XSQL: rm.member_principal_id = users.principal_id AND users.name = 3 ETQ398XSQL: N'ehi_shd') BEGIN THROW 50001, 3 ETQ398XSQL: N'shadow user did already exist in the EHI database but did not have the required permissions', 3 ETQ398XSQL: 1; END if(not exists(select * from sys.schemas where name 3 ETQ398XSQL: = 'ehi_shd')) EXEC 3 ETQ398XSQL: ('CREATE SCHEMA ehi_shd AUTHORIZATION ehi_shd') 3 ETQ398 SQL: EXECUTE AS USER = 'ehi_shd' IF EXISTS (select * from sys.objects 3 ETQ398XSQL: where name = 'sap_check_if_sick' and object_id = object_id('ehi_shd.' 3 ETQ398XSQL: + name, 'P') ) drop proc ehi_shd.sap_check_if_sick 3 ETQ398 SQL: create procedure sap_check_if_sick as begin select 'OK' 3 ETQ398XSQL: end 3 ETQ398 SQL: if ((select object_id('ehi_shd.sap_get_object_type', 'P')) IS NOT 3 ETQ398XSQL: NULL ) begin drop proc ehi_shd.sap_get_object_type; 3 ETQ398XSQL: end 3 ETQ398 SQL: CREATE proc sap_get_object_type @object_name sysname, 3 ETQ398XSQL: @schema_name sysname, @db_name sysname, @object_type 3 ETQ398XSQL: char(2) output AS BEGIN set nocount on; 3 ETQ398XSQL: declare @cmd nvarchar(1024); declare @pstr nvarchar(256); 3 ETQ398XSQL: if @schema_name is null or RTRIM(@schema_name) = N'' SET 3 ETQ398XSQL: @schema_name = schema_name(); set @cmd = 3 ETQ398XSQL: N'use ['+@db_name+N']; select @object_type = so.[type] from sys.objects so, ' 3 ETQ398XSQL: + 3 ETQ398XSQL: N'sys.schemas sch where sch.schema_id = so.schema_id and sch.name = @schema_name and ' 3 ETQ398XSQL: + N' so.[name] = @object_name '; set @pstr = 3 ETQ398XSQL: N'@object_type nvarchar(10) output, @schema_name sysname, @object_name sysname'; 3 ETQ398XSQL: exec sp_executesql @cmd, @pstr, @object_type 3 ETQ398XSQL: output,@schema_name,@object_name; END 3 ETQ398 SQL: GRANT ALL ON [ehi].[sap_upg_getrelease] TO ehi_shd REVERT; 3 ETQ398XSQL: SET NOCOUNT OFF 1 ETQ000 ================================================== 4 ETQ010 Date & Time: 20200722140408 1 ETQ003 exit code: "0"