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.
Hi,FieldA contain a string '05/23/2007' and I tried the following in the filter for comparsion and select the FieldA equal to current dateConvert(Datetime, FieldA, 101) = GetDate()It doesn't give me error, just no record returned.Am I do something wrong on that statement?Thanks!
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2007-05-23 : 22:18:17
What is the datatype for FeildA ? datetime or string ?KH
mapperkids
Yak Posting Veteran
50 Posts
Posted - 2007-05-23 : 22:33:53
The fieldA defined as nChar(12) string
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2007-05-23 : 22:39:10
any particular reason why you are not using datetime to store a date ?you can either use
Note : getdate() will return current date & time. The dateadd, datediff combination will set the time to 00:00:00You should use datetime data type for your FieldA if possible.KH