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, that is the old code written by somebody, Have no idea what it does, seems even incorrect.
SELECT count(*)FROM TaskWHERE Status = 6000 and (Status NOT IN (6000,7000)OR CONVERT(char(4),DATEADD(second, Create_Date, '1969-12-31 8:00:00 PM'),112) >= '2006'OR CONVERT(char(4),DATEADD(second, Actual_End_Date, '1969-12-31 8:00:00 PM'),112) >= '2006')
Thanks.
TG
Master Smack Fu Yak Hacker
6065 Posts
Posted - 2009-08-17 : 11:56:43
Well, the "SELECT count(*)" part will return the count of all the rows contained in the FROM clause that satisfy the criterial in the WHERE clause.The WHERE clause is broken. The DATEADD function is not structured properly.There is also a combination of AND/OR conditions. You typically would isolate them from each other using parenthises. possibly like this:where (A=A OR B=A) AND C=CBe One with the OptimizerTG