Click here to Skip to main content
15,914,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
select reg.RegID,reg.FName+' '+reg.MName+' '+reg.Surname as PatientName,reg.MName+' '+reg.Surname as PtName,reg.PAddress,
    CONVERT(char(10),reg.BDate,103)as BDate,(DATEDIFF(YEAR, reg.BDate, GETDATE())) AS Age,
    case when CONVERT(char(10),reg.MarriageDate,103)='01/01/1900' then '-' else
    (DATEDIFF(YEAR, reg.MarriageDate, GETDATE())) end as MrgYear ,
    CONVERT(char(10),reg.MarriageDate,103)as MarriageDate,reg.Religion,reg.BloodGroup,
    reg.HeighttFt,reg.HeightInc,reg.PWeight,
    reg.Mobile,reg.Mail,reg.Gender,reg.Occupation,reg.RegistrationFor,
    logi.Password,CONVERT(char(10),reg.EntryDate,103) as EntryDate,ad.Name as CityName
  from RegistrationMst reg left outer join LoginMst logi on (reg.RegID=logi.UserID)
  inner join AddressMst ad on (reg.CityID=ad.SrNo)
  where reg.IsActive=1
  and (reg.RegID=@RegID or @RegID=-1)
  and (reg.Mobile like '%'+ @Mobile +'%' or @Mobile='')



   and ((CONVERT(char(10),reg.EntryDate,103) between (CONVERT(char(10),@FromDate,103)) and CONVERT(char(10),@ToDate,103)) or

 (CONVERT(char(10),@FromDate,103)='01/01/1900' and CONVERT(char(10),@ToDate,103)='01/01/1900'))
Posted
Comments
Adarsh chauhan 8-Jul-13 6:38am    
what is the actual problem you are facing??
you have provided your sql query but not you have not explained that what prob. you are facing. please provide your table structure if possible..
_Asif_ 8-Jul-13 7:07am    
Please improve your question

1 solution

Try (CONVERT(CHAR(10), '01/01/1900', 103) in place of '01/01/1900'.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900