<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <Body>
    <ReportItems>
      <Textbox Name="Textbox2">
        <CanGrow>true</CanGrow>
        <KeepTogether>true</KeepTogether>
        <Paragraphs>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value>="The Dropped Database Users Extended Event Session has been created on " &amp; First(Fields!ServerName.Value, "ServerName")</Value>
                <Style>
                  <FontSize>26pt</FontSize>
                  <Color>White</Color>
                </Style>
              </TextRun>
            </TextRuns>
            <Style>
              <TextAlign>Center</TextAlign>
            </Style>
          </Paragraph>
        </Paragraphs>
        <rd:DefaultName>Textbox2</rd:DefaultName>
        <Top>0.3375in</Top>
        <Left>0.325in</Left>
        <Height>2.30834in</Height>
        <Width>5.85833in</Width>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
          <VerticalAlign>Middle</VerticalAlign>
          <PaddingLeft>2pt</PaddingLeft>
          <PaddingRight>2pt</PaddingRight>
          <PaddingTop>2pt</PaddingTop>
          <PaddingBottom>2pt</PaddingBottom>
        </Style>
      </Textbox>
      <Textbox Name="Textbox1">
        <CanGrow>true</CanGrow>
        <KeepTogether>true</KeepTogether>
        <Paragraphs>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value>Back To Deployment Page</Value>
                <Style>
                  <FontSize>22pt</FontSize>
                  <Color>DarkBlue</Color>
                </Style>
              </TextRun>
            </TextRuns>
            <Style>
              <TextAlign>Center</TextAlign>
            </Style>
          </Paragraph>
        </Paragraphs>
        <rd:DefaultName>Textbox1</rd:DefaultName>
        <ActionInfo>
          <Actions>
            <Action>
              <Drillthrough>
                <ReportName>MonitorDeployAdminMonitor</ReportName>
              </Drillthrough>
            </Action>
          </Actions>
        </ActionInfo>
        <Top>2.77083in</Top>
        <Left>0.325in</Left>
        <Height>0.59167in</Height>
        <Width>5.85833in</Width>
        <ZIndex>1</ZIndex>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
          <BackgroundColor>LightSteelBlue</BackgroundColor>
          <VerticalAlign>Middle</VerticalAlign>
          <PaddingLeft>2pt</PaddingLeft>
          <PaddingRight>2pt</PaddingRight>
          <PaddingTop>2pt</PaddingTop>
          <PaddingBottom>2pt</PaddingBottom>
        </Style>
      </Textbox>
    </ReportItems>
    <Height>3.58333in</Height>
    <Style>
      <Border>
        <Style>None</Style>
      </Border>
      <BackgroundColor>DarkBlue</BackgroundColor>
    </Style>
  </Body>
  <Width>6.5in</Width>
  <Page>
    <LeftMargin>1in</LeftMargin>
    <RightMargin>1in</RightMargin>
    <TopMargin>1in</TopMargin>
    <BottomMargin>1in</BottomMargin>
    <Style />
  </Page>
  <AutoRefresh>0</AutoRefresh>
  <DataSources>
    <DataSource Name="LocalHost">
      <ConnectionProperties>
        <DataProvider>SQL</DataProvider>
        <ConnectString>Data Source=localhost;Initial Catalog=master</ConnectString>
        <IntegratedSecurity>true</IntegratedSecurity>
      </ConnectionProperties>
      <rd:SecurityType>Integrated</rd:SecurityType>
      <rd:DataSourceID>0123a821-e7a7-4de7-b5d3-f20817df5bb6</rd:DataSourceID>
    </DataSource>
  </DataSources>
  <DataSets>
    <DataSet Name="ServerName">
      <Query>
        <DataSourceName>LocalHost</DataSourceName>
        <CommandText>Select @@servername AS 'ServerName'</CommandText>
      </Query>
      <Fields>
        <Field Name="ServerName">
          <DataField>ServerName</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
    <DataSet Name="CreateDroppedDBUserEventSession">
      <Query>
        <DataSourceName>LocalHost</DataSourceName>
        <CommandText>USE AdminMonitor



DECLARE @EEPath NVARCHAR(100)
DECLARE @SQL NVARCHAR(1000)

SELECT @EEPath = configvalue + '\DroppedDBUser.xel'
FROM AdminMonitor.dbo.Config
WHERE ConfigTitle = 'ExtendedEventFolder'


SET @SQL = N'CREATE EVENT SESSION [DropUser] ON SERVER 
ADD EVENT sqlserver.sql_statement_completed(SET collect_statement=(1)
    ACTION(sqlserver.client_hostname,sqlserver.database_name,sqlserver.nt_username,sqlserver.sql_text,sqlserver.username)
    WHERE ([sqlserver].[like_i_sql_unicode_string]([sqlserver].[sql_text],N''Drop User%'')))
ADD TARGET package0.event_file(SET filename= ''' + @EEPath + ''')
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=ON)'

EXECUTE sp_executesql @SQL

ALTER EVENT SESSION  DropUser
ON SERVER  
STATE = Start


Select * from Sysdatabases</CommandText>
      </Query>
      <Fields>
        <Field Name="name">
          <DataField>name</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="dbid">
          <DataField>dbid</DataField>
          <rd:TypeName>System.Int16</rd:TypeName>
        </Field>
        <Field Name="sid">
          <DataField>sid</DataField>
          <rd:TypeName>System.Byte[]</rd:TypeName>
        </Field>
        <Field Name="mode">
          <DataField>mode</DataField>
          <rd:TypeName>System.Int16</rd:TypeName>
        </Field>
        <Field Name="status">
          <DataField>status</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="status2">
          <DataField>status2</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="crdate">
          <DataField>crdate</DataField>
          <rd:TypeName>System.DateTime</rd:TypeName>
        </Field>
        <Field Name="reserved">
          <DataField>reserved</DataField>
          <rd:TypeName>System.DateTime</rd:TypeName>
        </Field>
        <Field Name="category">
          <DataField>category</DataField>
          <rd:TypeName>System.Int32</rd:TypeName>
        </Field>
        <Field Name="cmptlevel">
          <DataField>cmptlevel</DataField>
          <rd:TypeName>System.Byte</rd:TypeName>
        </Field>
        <Field Name="filename">
          <DataField>filename</DataField>
          <rd:TypeName>System.String</rd:TypeName>
        </Field>
        <Field Name="version">
          <DataField>version</DataField>
          <rd:TypeName>System.Int16</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
  </DataSets>
  <rd:ReportUnitType>Inch</rd:ReportUnitType>
  <rd:ReportID>a83fa79e-a6ba-4e5c-b6d7-b8bfc9b53792</rd:ReportID>
</Report>