CREATE PROCEDURE get_DVCount
as
return (SELECT COUNT(*) AS CountOfDV from [Module Log] WHERE [Access Module Time] >= DATEADD(m,-1,DATEADD(m,DATEDIFF(m,0,GETDATE()),0)) AND [Access Module Time] < DATEADD(m,DATEDIFF(m,0,GETDATE()),0) GROUP BY [Module Name]
HAVING ([Module Name] = 'Domestic Violence'))
GO
DECLARE @DVCount int
EXEC @DVCount=get_DVCount
I used this before. It work right now did not return anything. I tried to run the query , it have row. can't figure out why.
Thx.