<?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="Textbox1">
        <CanGrow>true</CanGrow>
        <KeepTogether>true</KeepTogether>
        <Paragraphs>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value />
                <Style>
                  <FontSize>14pt</FontSize>
                </Style>
              </TextRun>
            </TextRuns>
            <Style />
          </Paragraph>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value>SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'Possible Function in WHERE clause' AS 'Reason'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%WHERE%(%) =%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'Possible Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%WHERE%(%) LIKE%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'LEFT Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%WHERE %LEFT(%) LIKE%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'RIGHT Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %RIGHT(%) LIKE%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'YEAR Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where% YEAR(%) LIKE%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'MONTH Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %MONTH(%) LIKE%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'SUBSTRING Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %Substring(%) LIKE%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'ISNULL Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %ISNULL(%) LIKE%'

UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'TRIM Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %TRIM(%) LIKE%'
UNION

SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'Leading % in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where%LIKE ''[%]%'

UNION

SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'LEFT Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%WHERE %LEFT(%) =%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'RIGHT Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %RIGHT(%) =%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'YEAR Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %YEAR(%) =%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'MONTH Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %MONTH(%) =%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'SUBSTRING Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %Substring(%) =%'
UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'ISNULL Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %ISNULL(%) =%'


UNION
SELECT DISTINCT  p.name
, Schema_name(p.schema_id) AS 'SchemaName'
, p.create_date
, p.modify_date
, 'TRIM Function in WHERE clause'
FROM syscomments c
INNER JOIN sys.procedures p
	ON c.id = p.object_id
WHERE c.text LIKE '%where %TRIM(%) =%'


</Value>
                <Style>
                  <FontSize>14pt</FontSize>
                </Style>
              </TextRun>
            </TextRuns>
            <Style />
          </Paragraph>
        </Paragraphs>
        <rd:DefaultName>Textbox1</rd:DefaultName>
        <Top>1.59667in</Top>
        <Left>0.40833in</Left>
        <Height>39.84166in</Height>
        <Width>8.23332in</Width>
        <Style>
          <Border>
            <Style>Solid</Style>
          </Border>
          <BackgroundColor>LightBlue</BackgroundColor>
          <PaddingLeft>8pt</PaddingLeft>
          <PaddingRight>2pt</PaddingRight>
          <PaddingTop>2pt</PaddingTop>
          <PaddingBottom>2pt</PaddingBottom>
        </Style>
      </Textbox>
      <Textbox Name="Textbox2">
        <CanGrow>true</CanGrow>
        <KeepTogether>true</KeepTogether>
        <Paragraphs>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value>Nonsargable Stored Procedures Code</Value>
                <Style>
                  <FontSize>18pt</FontSize>
                  <Color>White</Color>
                </Style>
              </TextRun>
            </TextRuns>
            <Style>
              <TextAlign>Center</TextAlign>
            </Style>
          </Paragraph>
        </Paragraphs>
        <rd:DefaultName>Textbox2</rd:DefaultName>
        <Top>0.19236in</Top>
        <Left>0.40833in</Left>
        <Height>0.425in</Height>
        <Width>8.23332in</Width>
        <ZIndex>1</ZIndex>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
          <BackgroundColor>DarkBlue</BackgroundColor>
          <VerticalAlign>Middle</VerticalAlign>
          <PaddingLeft>2pt</PaddingLeft>
          <PaddingRight>2pt</PaddingRight>
          <PaddingTop>2pt</PaddingTop>
          <PaddingBottom>2pt</PaddingBottom>
        </Style>
      </Textbox>
      <Textbox Name="Textbox4">
        <CanGrow>true</CanGrow>
        <KeepTogether>true</KeepTogether>
        <Paragraphs>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value>Go to Main Report</Value>
                <Style>
                  <FontSize>14pt</FontSize>
                  <Color>White</Color>
                </Style>
              </TextRun>
            </TextRuns>
            <Style>
              <TextAlign>Center</TextAlign>
            </Style>
          </Paragraph>
        </Paragraphs>
        <rd:DefaultName>Textbox3</rd:DefaultName>
        <ActionInfo>
          <Actions>
            <Action>
              <Drillthrough>
                <ReportName>=IIF(First(Fields!ProductMajorVersion.Value, "Version") = 10 and First(Fields!EngineEdition.Value, "ServerProperty") &lt;&gt; 5, "MainReport2008", 
IIF(First(Fields!EngineEdition.Value, "ServerProperty") = 5, Nothing, 
IIF(First(Fields!ProductMajorVersion.Value, "Version") &gt; 10 and First(Fields!EngineEdition.Value, "ServerProperty") &lt;&gt; 5, "MainReport", Nothing)))</ReportName>
              </Drillthrough>
            </Action>
          </Actions>
        </ActionInfo>
        <Top>0.6868in</Top>
        <Left>0.40833in</Left>
        <Height>0.36667in</Height>
        <Width>8.23333in</Width>
        <ZIndex>2</ZIndex>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
          <BackgroundColor>DimGray</BackgroundColor>
          <VerticalAlign>Middle</VerticalAlign>
          <PaddingLeft>2pt</PaddingLeft>
          <PaddingRight>2pt</PaddingRight>
          <PaddingTop>2pt</PaddingTop>
          <PaddingBottom>2pt</PaddingBottom>
        </Style>
      </Textbox>
      <Textbox Name="Textbox8">
        <CanGrow>true</CanGrow>
        <KeepTogether>true</KeepTogether>
        <Paragraphs>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value>Go to Report Library</Value>
                <Style>
                  <FontSize>14pt</FontSize>
                  <Color>White</Color>
                </Style>
              </TextRun>
            </TextRuns>
            <Style>
              <TextAlign>Center</TextAlign>
            </Style>
          </Paragraph>
        </Paragraphs>
        <rd:DefaultName>Textbox5</rd:DefaultName>
        <ActionInfo>
          <Actions>
            <Action>
              <Drillthrough>
                <ReportName>ReportLibrary</ReportName>
              </Drillthrough>
            </Action>
          </Actions>
        </ActionInfo>
        <Top>1.11597in</Top>
        <Left>0.40833in</Left>
        <Height>0.36667in</Height>
        <Width>3.99303in</Width>
        <ZIndex>3</ZIndex>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
          <BackgroundColor>DimGray</BackgroundColor>
          <VerticalAlign>Middle</VerticalAlign>
          <PaddingLeft>2pt</PaddingLeft>
          <PaddingRight>2pt</PaddingRight>
          <PaddingTop>2pt</PaddingTop>
          <PaddingBottom>2pt</PaddingBottom>
        </Style>
      </Textbox>
      <Textbox Name="Textbox9">
        <CanGrow>true</CanGrow>
        <KeepTogether>true</KeepTogether>
        <Paragraphs>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value>Back to the Report</Value>
                <Style>
                  <FontSize>14pt</FontSize>
                  <Color>White</Color>
                </Style>
              </TextRun>
            </TextRuns>
            <Style>
              <TextAlign>Center</TextAlign>
            </Style>
          </Paragraph>
        </Paragraphs>
        <rd:DefaultName>Textbox6</rd:DefaultName>
        <ActionInfo>
          <Actions>
            <Action>
              <Drillthrough>
                <ReportName>NonSargAbleStoredProcs</ReportName>
              </Drillthrough>
            </Action>
          </Actions>
        </ActionInfo>
        <Top>1.11597in</Top>
        <Left>4.4708in</Left>
        <Height>0.36667in</Height>
        <Width>4.17086in</Width>
        <ZIndex>4</ZIndex>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
          <BackgroundColor>DimGray</BackgroundColor>
          <VerticalAlign>Middle</VerticalAlign>
          <PaddingLeft>2pt</PaddingLeft>
          <PaddingRight>2pt</PaddingRight>
          <PaddingTop>2pt</PaddingTop>
          <PaddingBottom>2pt</PaddingBottom>
        </Style>
      </Textbox>
    </ReportItems>
    <Height>41.64166in</Height>
    <Style>
      <BackgroundColor>Silver</BackgroundColor>
    </Style>
  </Body>
  <Width>9.05in</Width>
  <Page>
    <PageHeight>300in</PageHeight>
    <LeftMargin>1in</LeftMargin>
    <RightMargin>1in</RightMargin>
    <TopMargin>1in</TopMargin>
    <BottomMargin>1in</BottomMargin>
    <Style />
  </Page>
  <AutoRefresh>0</AutoRefresh>
  <DataSources>
    <DataSource Name="Local">
      <ConnectionProperties>
        <DataProvider>SQL</DataProvider>
        <ConnectString>Data Source=localhost;Initial Catalog=master</ConnectString>
        <IntegratedSecurity>true</IntegratedSecurity>
      </ConnectionProperties>
      <rd:SecurityType>Integrated</rd:SecurityType>
      <rd:DataSourceID>7ecfb5ec-b832-4438-ac4f-a88008146714</rd:DataSourceID>
    </DataSource>
  </DataSources>
  <DataSets>
    <DataSet Name="Version">
      <Query>
        <DataSourceName>Local</DataSourceName>
        <CommandText>SELECT  SERVERPROPERTY('ProductMajorversion') AS 'ProductMajorVersion'</CommandText>
      </Query>
      <Fields>
        <Field Name="ProductMajorVersion">
          <DataField>ProductMajorVersion</DataField>
          <rd:TypeName>System.Object</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
    <DataSet Name="ServerName">
      <Query>
        <DataSourceName>Local</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="ServerProperty">
      <Query>
        <DataSourceName>Local</DataSourceName>
        <CommandText>SELECT ServerProperty('EngineEdition') AS 'EngineEdition'</CommandText>
      </Query>
      <Fields>
        <Field Name="EngineEdition">
          <DataField>EngineEdition</DataField>
          <rd:TypeName>System.Object</rd:TypeName>
        </Field>
      </Fields>
    </DataSet>
  </DataSets>
  <rd:ReportUnitType>Inch</rd:ReportUnitType>
  <rd:ReportID>43b8fe02-5dee-4b69-894e-b90a99a82453</rd:ReportID>
</Report>