Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
from my table:convert(varchar,Rec.expdate,101) as exp: 01/19/203808/12/201308/12/2013I only want record is >= the current date but looks like my syntax is not working right because I got nothing return instead of 01/19/2038. An any one help? Thanks-----and convert(varchar,Rec.expdate,101) >=convert(varchar,getdate(),101)
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts
Posted - 2013-09-25 : 12:34:44
You are converting the date to varchar format, "09/25/2013", so the compare is done as a varchar.You should compare as a datetime value:
and Rec.expdate >= convert(datetime,convert(date,getdate()))