Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hello Friends
I have a problem that i want to data between Two date .on sunday holiday.even though i get sunday Date in my Records..
 
Ex
IF i entered 1-1-2013 and 31-1-2013
it shows Record as
 
1-1-2013
2-1-2013
3-1-2013
...
...
...
...
...
...
...
...
31-1-2013
Posted 30-Jan-13 0:51am
Comments
Ankur\m/ at 30-Jan-13 6:39am
   
So do you not need weekends (or specific day in your result)? how would Sql know that. You must write the condition in your query. Show us your query and we might be able to help with your issue.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

So what exactly the issue? you given 1-1-2013 and 31-1-2013 and its giving the data.
 
Also spcify where you are fetching data ? SQL? If yes, you may have to use correct operator. For example
 
select * from table1
where 
date < endDate and
date > startDate
 
Hope that helps
Milind
  Permalink  
Comments
Ankur\m/ at 30-Jan-13 6:40am
   
Your answer seems more like a comment to me.
hardy panchal at 31-Jan-13 1:09am
   
actually sir i Did the same thing bust still it get record that it inserted on that dat not all date
MT_ at 31-Jan-13 1:10am
   
as everyone said, show your code i.e. SP , you may remove/modify if there is any sensitive information.
hardy panchal at 31-Jan-13 1:34am
   
ALTER PROCEDURE [dbo].[GetDaillyAttendanceReport]
 
@FDate DateTime =null,
@TDate DateTime =null
AS
BEGIN
select
D.*
(case when (Presence='P') then 'P' when (Presence='A') then 'A' else '' end)as Att
from Usp_Getdate('01-01-2013','01-31-2013') a
left Join DailyAttandanceEntryMaster as D on a.date=D.date
 
where (@EmpID is null Or @EmpID=0 or D.EmpID=@EmpID)
 
And (D.Date Between @FDate and @TDate) Order by D.Date
 
Usp_GetDate is Function For get All Date and compare it with DailyAttendanceMaster...bt it get only match date data not all Date
MT_ at 31-Jan-13 1:44am
   
so it is getting data of 01-Jan-2013 and 31-Jan-2013 only? And you want all 31 days data. Is that right understanding? If yes, need to see USP_GetDate function.
hardy panchal at 31-Jan-13 3:15am
   
ALTER FUNCTION [dbo].[Usp_Getdate]
(
@startDate DATETIME,
@endDate DATETIME
)
RETURNS @date TABLE
(
date datetime NOT NULL
)
AS
 
begin
WITH dates(Date) AS
(
SELECT @startdate as Date
UNION ALL
SELECT DATEADD(d,1,[Date])
FROM dates
WHERE DATE < @enddate
)
insert into @date
SELECT Date
FROM dates
OPTION (MAXRECURSION 0)
return
end

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 400
1 Maciej Los 222
2 OriginalGriff 213
3 Zoltán Zörgő 135
4 BillWoodruff 130
0 OriginalGriff 7,969
1 DamithSL 6,139
2 Sergey Alexandrovich Kryukov 5,449
3 Maciej Los 5,309
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 30 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100