Query view date created template SAM

Hi,

I write one query for view the date created templated in SAM

SET NOCOUNT OFF
SET ROWCOUNT 0
DECLARE @StartDate DateTime
DECLARE @EndDate DateTime
DECLARE @Rango DateTime
DECLARE @ResultVar real
SET @StartDate = DATEADD(DD,-30,DATEADD(DD,DATEDIFF(DD,0,GETDATE()),0))
SET @EndDate = DATEADD(DD,0,DATEADD(DD,DATEDIFF(DD,0,GETDATE()),0))

SELECT
a.name
,n.caption
,a.created
,a.lastModified

FROM APM_Application A
INNER JOIN Nodes N ON a.nodeid = n.nodeid
WHERE a.Created >= @StartDate AND a.Created < @EndDate
--AND Name like '%Teisa%'

ORDER BY a.Created