urgent:sql query

Results 1 to 2 of 2

Thread: urgent:sql query

  1. #1
    Turt Guest

    Default urgent:sql query

    thanx for u&#039r help.<BR><BR>I have a problem in writing a query to retrieve records having today&#039s date .<BR>I tired using getdate() but it gives a wrong date as 05/01/2000.<BR>please help.<BR><BR>my query is;<BR><BR>"select * from table where convert(varchar(30),date,101)=convert(varchar(30), getdate(),101)"<BR><BR>i also tired this code.<BR><BR>&#060;%dat=date<BR>"select * from table where convert(varchar(30),date,101)=convert(varchar(30), &#039"&dat&"&#039,101)"<BR><BR>but this is also not working becoz<BR>convert(varchar(30),&#039"&dat&"&#039,101 ) returns the date as 2/8/2000 whereas <BR>convert(varchar(30),date,101) returns 02/08/2000<BR><BR>so no matching records can be found.<BR><BR>Please help.<BR>Thank you.<BR><BR>Turt<BR>

  2. #2
    Mark Guest

    Default RE: urgent:sql query

    Try these :<BR><BR>SELECT CONVERT(char(12),GETDATE(),3)<BR><BR>it converts the current date to style 3 , dd/mm/yy<BR>I hope it will work .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts