SQL Script to attach to foreign database

Version 1

    Sometimes you need to connect to a LDMS database from a foreign system.  This script will update that database for use in your core environment.  It only changes a few bits that you can't get to from a GUI.

     

    USE [DATABASE-NAME]
    GO
    
    UPDATE [METASYSTEMS]
    SET [SYSTEMNAME]='HOSTNAME_OF_CORE'
    GO
    
    UPDATE [METASYSTEMS]
    SET [CORESERVER]='HOSTNAME_OF_CORE'
    GO
    
    TRUNCATE TABLE [APM_LDAP_SERVER]
    GO
    
    SET IDENTITY_INSERT [[APM_LDAP_SERVER] ON
    
    INSERT INTO [APM_LDAP_SERVER]
        ([APM_LDAP_SERVER_IDN]
        ,[LDAP_SERVER_URL]
        ,[LDAP_SECURITY]
        ,[LDAP_USERNAME]
        ,[LDAP_PASSWORD])
    VALUES (9
        ,'LDAP://DOMAIN_NAME'
        ,1
        ,'DOMAIN_ADMIN'
        ,'HASHED_PASSWORD')
    
    SET IDENTITY_INSERT [APM_LDAP_SERVER] OFF
    GO