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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CASE help

Author  Topic 

Chris_Kelley
Posting Yak Master

114 Posts

Posted - 2014-08-29 : 09:41:52
c

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-08-29 : 09:49:53
First off, you can get rid of all the parentheses. They aren't needed and only make it harder to read.

Second, remove "WITH (NOLOCK)" You can get wonky results. (see: http://www.techrepublic.com/article/using-nolock-and-readpast-table-hints-in-sql-server/)

Third, what datatypes are the columns DOR and CHECKDATE?
Go to Top of Page

Chris_Kelley
Posting Yak Master

114 Posts

Posted - 2014-08-29 : 09:53:11
c
Go to Top of Page

Chris_Kelley
Posting Yak Master

114 Posts

Posted - 2014-08-29 : 10:28:09
c
Go to Top of Page

Chris_Kelley
Posting Yak Master

114 Posts

Posted - 2014-08-29 : 12:00:25
c
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-08-29 : 14:19:32
"my company requires with(nolock) on any db"

WOW. just...WOW.

What an extraordinarily bad idea.
Go to Top of Page

Chris_Kelley
Posting Yak Master

114 Posts

Posted - 2014-08-29 : 18:00:07
c
Go to Top of Page
   

- Advertisement -