no my Altaf Bro.
i think u didn't get my point.
my query is checking all this things. but when the days remain less than
10 then is never goes and check from the upcoming month days.
i mean. for example my dob is 30 April. so it starts give me msg from
20th April. (because it comes in next 10 day defined period) but at 21st
April that 10 days period cover 1st May also, but it not calculate
cause of month didn't change. as i told i want data like we see in
orkut nd other social websites. how they filter the dob nd fetch it form
database
i hope this may clear my requirement i gone though all my efforts but
stuck in month case.
please if anyone knows abt it bd understand my problem please please
tell me the solution
Thanks
Loading
Amit ChoudharyPosted May 2, 2010, 10:44 AM
Well you have already solved the problem but there's a tricky thing you have to change in your query..
ALTER PROCEDURE dbo.usp_ShowDateofBirth
As
select FirstName,DOB from PersonalAddBook where CAST(CAST(MONTH(DOB) AS VARCHAR(2)) + '/' +
CAST(DAY(DOB) AS VARCHAR(2)) + '/' +
CAST(YEAR(
DOBreplace this by getdate()) AS VARCHAR(4))AS DATETIME)between getdate() and getdate()+10its because of you are comparing your Birthdate foreg: 13-10-1987 to 16-10-2010 by adding 10 days in it.. it'll never give you records. i have just changed the year in Birthdate so its now working.
and your problem solved. i have tried it on my PC and its running great.
Please mark "Do you like my post" if it helps you.
Rashid KhanPosted May 1, 2010, 6:12 AM
i m expecting reply from you.
this is my query which i try to fetch those birthday with come in next 10 dates of the current date.
select FirstName,DOB from PersonalAddBook where month(DOB)=month(getdate())
AND day(DOB)>=day(getdate()) order by DOB asc
but from this.when less then 10 days remain in month it never count the next month date until the month not change in current date. i mean it fetch record till 30-31 but if the dob is 1st of may then it return zero cause it cont is only when the month change in current date time.
i also try this but no row return
ALTER PROCEDURE dbo.usp_ShowDateofBirth
As
/*select FirstName,DOB from PersonalAddBook where CAST(CAST(MONTH(DOB) AS VARCHAR(2)) + '/' +
CAST(DAY(DOB) AS VARCHAR(2)) + '/' +
CAST(YEAR(DOB) AS VARCHAR(4))AS DATETIME)between getdate() and getdate()+10
please tell me where i m missing something
Thanks
Amit ChoudharyPosted May 1, 2010, 3:42 AM
well i don't think its as big issue .. you consider it... make a query that can fetch records from you database on the basis of where condition in which B'dates are less then (adding 10 days in current Date) and greater then the Yesterdays date
and you'll get the set of record falling under this condition. Now you can also add custom fields in your resulting table for days remaining. on the basis of that .. if it 0 day then show message "Today is b'day" else show message "3 days remaining for the big day" etc like that.
Hope you got my point.
Please mark "Do you like this post" if it helps you.