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.
| Author |
Topic |
|
mapperkids
Yak Posting Veteran
50 Posts |
Posted - 2007-05-16 : 16:39:51
|
| Hi,If I want to setup a filter for a field which is inside the view. How to do thatI try something like FieldA > = (date()-60), it give me error saying the date()is not a valid built-in function?Thanks! |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-05-16 : 16:44:54
|
| Try getdate() instead. |
 |
|
|
mapperkids
Yak Posting Veteran
50 Posts |
Posted - 2007-05-16 : 17:11:56
|
| Thanks!But the fieldA that I want to compare is a string like "07/05/16", so how can I convert the GETDATE() statement to compare it?I want to filter the view only includes records for two months oldlike FieldA > = GETDATE() - 60Thanks ! |
 |
|
|
sshelper
Posting Yak Master
216 Posts |
Posted - 2007-05-16 : 17:16:02
|
| Try converting your FieldA into DATETIME so that it will compare as DATETIME and not as string:CONVERT(DATETIME, FieldA, 11) >= GETDATE() - 60SQL Server Helperhttp://www.sql-server-helper.com |
 |
|
|
|
|
|