I'm reviewing an application running on MS-SQL 2008 R2.
When I review Current / Most Executed queries I discovered many with DDL in them being run thousands of times a hour.
The developer swears this is impossible, but when I see DDL from what I'm assuming is the equivalent to SQL Trace SQL:StmtCompleted I'm puzzled.
Is there any reason to believe that this DDL is not running as it is shown below?
Thanks
Steve
Example:
/* (inserted by DPA)
Procedure: 1267SAMPLE.dbo.GetOrderScheduleCount
Character Range: 227 to 422
Waiting on statement:
Select @intTotal =
(
SELECT Count(DISTINCT ScheduleNo)
FROM Schedule
WHERE vPayerNo=@PayerNo
AND OrderNo = @OrderNo
AND vCareType = @CareType
AND VDat BETWEEN @FromDate AND @ThroughDate
)
*/
CREATE
FUNCTION [dbo].[GetOrderScheduleCount]
(
@PayerNo varchar(3),
@OrderNo int,
@CareType varchar(25),
@FromDate varchar(25),
@ThroughDate varchar(25)
)
RETURNS int
.....