Viewing 15 posts - 481 through 495 (of 1,473 total)
I can suggest an alternative method depending on how that one performs on your real table. Let us know how it goes once you get it all re-wired.
October 20, 2009 at 5:17 pm
Assuming that the real code will use DATEADD instead of +1 to modify the dates, it seems like it would work better. What determines the values that you still...
October 20, 2009 at 5:07 pm
timscronin (10/20/2009)
I guess the whole question which is more efficient, not in, not exists, left join
AFAIK, there's no straight answer to that question. Each of them written correctly can...
October 20, 2009 at 3:54 pm
Check out ROW_NUMBER, which Andras also mentioned in his post.
Here's a hint: ROW_NUMBER() OVER (PARTITION BY Customer_ID ORDER BY Customer_ID)
Edit: Typo.
October 20, 2009 at 2:10 pm
Try running this.
SELECT T1.Val3, T3.Val2, COUNT(T3.Val1)
FROM Table1 AS T1
INNER JOIN Table2 AS T2 ON T1.SomeID = T2.SomeID -- Fixed Join, you have T1=T1
LEFT JOIN Table4 AS T4 ON T4.SomeID =...
October 20, 2009 at 1:59 pm
IIRC, varchar values are compared by looking at the ANSI values of each character going from left to right.
DECLARE @a TABLE(vc varchar(20))
INSERT INTO @a(vc)
SELECT 'bafeajk' UNION ALL
SELECT 'abfaefafea' UNION ALL
SELECT...
October 20, 2009 at 1:07 pm
And by the way. I experimented with just rewriting the query so that the subquery is a left join in the outer query and it works just fine every time....
October 20, 2009 at 8:50 am
The article I does only cite 7.0 and 2000, but although many tests might show it works just fine, that by no means makes me confident that the issue was...
October 20, 2009 at 8:31 am
This was my source for it not being guaranteed:
http://support.microsoft.com/kb/273586
I actually just found that about a week ago so it was fresh on my mind.
October 20, 2009 at 7:47 am
Oops, good catch Tom.
Also, Hal, I'd think about Bob's solution. The table may be small now and the performance difference minor, but as it grows, so would the difference...
October 20, 2009 at 7:18 am
You should be able to make that case statement a calculated field so that you don't need to actually update it. The field is automatically updated as soon as...
October 19, 2009 at 5:10 pm
Something like this:
ORDER BY CASE WHEN Col='Other' THEN 1 ELSE 2 END, Col
October 19, 2009 at 5:01 pm
Does this return the correct results?
select count(1) as total, mn1.category from Metric m1
inner JOIN Manager mn1 ON mn1.[Login] = m1.createuserid
where m1.status = 'Pending' and type = 'updateTargetAccountPassword'
mn1.category not in...
October 19, 2009 at 2:46 pm
And at that point, you've just lost even the 'perceived' benefit of manually inserting the identity column, because it won't link. Identity columns exist so that you don't have...
October 19, 2009 at 10:49 am
You did it perfectly, thank you. So, this gets you to where you were before, maybe a bit farther, and uses joins. I'd ditch the create table(just use...
October 19, 2009 at 10:29 am
Viewing 15 posts - 481 through 495 (of 1,473 total)