Thanks Visakh its working now. just made some adjustment. =IIF(Day(Now()) > 26,MonthName(Month(Now())+1,3)&"-"&Year(now()),MonthName(Month(Now()),3)&"-"&Year(now())) Btw, Its possible to use case statement to loop the dates from Where clause instead of using while and Begin statement.I need to work on if the current dates falls in Monday need to less 1 day else no changes from the date.Or it possible to check if no records extracted and inserted to temporary table then need to less 1 day from the date.below is my query. see below sample:From Date: 9/1/2013 To date:9/2/2013FromTime: 6:00AM Totime: 6:00AMOrderMonth: Sep-2013 SELECT *FROM DATA1 PR1---Loop back this date if there's no record found from Query, sunday has no transaction--or use case statementWHERE ??? if false on monday CASE DATEADD(HOUR,convert(int,@timezoneOffset), PR.createddatetime) BETWEEN DATEADD(DAY,1,@PFromDate) AND DATEADD(DAY,1,@PToDate)ELSE CASE DATEADD(HOUR,convert(int,@timezoneOffset), PR.createddatetime) BETWEEN DATEADD(DAY,0,@PFromDate) AND DATEADD(DAY,0,@PToDate)ENDCASE-----------------My Main Query-------- --Temporary TableIF OBJECT_ID('tempdb.dbo.#PROD') IS NOT NULL DROP TABLE [dbo].[#PROD] CREATE TABLE #PROD ( XWRKCTRID NVARCHAR(20) ,XCREATEDBY NVARCHAR(10) ,XASUSTATUS INT ,XOPRNUM INT ,XCREATEDDATETIME Datetime ,XMODEL NVARCHAR(35) )--Insert records INSERT INTO #PROD(XWRKCTRID ,XCREATEDBY ,XASUSTATUS ,XOPRNUM ,XCREATEDDATETIME ,XMODEL) --Main QuerySELECT PR1.XWRKCTRID ,PR1.XCREATEDBY ,PR1.XASUSTATUS ,PR1.XOPRNUM ,PR1.XCREATEDDATETIME ,substring(PT1.XITEMID,11,CHARINDEX('-',PT1.XITEMID,11)-11) as MODELFROM DATA1 PR1---Loop back this date if there's no record found from Query, sunday has no transaction--or use case statementWHERE ??? if false on monday CASE DATEADD(HOUR,convert(int,@timezoneOffset), PR.createddatetime) BETWEEN DATEADD(DAY,1,@PFromDate) AND DATEADD(DAY,1,@PToDate)ELSE CASE DATEADD(HOUR,convert(int,@timezoneOffset), PR.createddatetime) BETWEEN DATEADD(DAY,0,@PFromDate) AND DATEADD(DAY,0,@PToDate)ENDCASE