Viewing 15 posts - 4,051 through 4,065 (of 7,613 total)
Hard to determine exactly what you want, but my best guess is something like below; adjust the case conditions to be specifically what you need them to be:
select *
from (
...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 1, 2016 at 2:15 pm
mitzyturbo (11/1/2016)
do you mean by just having a clustered index by the modified date on both log...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 1, 2016 at 12:05 pm
Properly clustering should still allow a merge join, which should be much faster than anything you're having to do now.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 1, 2016 at 11:17 am
Cluster the log table on the relevant arrival datetime that you are comparing by (rather than, presumably, a meaningless identity value). Then query directly from the table, joining to...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
November 1, 2016 at 10:51 am
drew.allen (10/31/2016)
ScottPletcher (10/31/2016)
Latin actually is the base for many romance languages.
Latin is the base for ALL Romance languages. I have an MA in Linguistics, so I have some idea what...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 31, 2016 at 3:41 pm
CELKO (10/28/2016)
This mistake is most commonly made by old COBOL programmers, because COBOL represents everything in character strings.
No, actually COBOL had numeric values as well. For example, packed decimal...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 31, 2016 at 9:57 am
CELKO (10/31/2016)
I doubt the vast majority of developers today have even heard of COBOL, and they certainly have never programmed in it.
Yep, and nobody takes Latin either. Yet everywhere you...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 31, 2016 at 7:57 am
david.jack (10/31/2016)
ScottPletcher (10/28/2016)
david.jack (10/28/2016)
ScottPletcher (10/27/2016)
Seems more confusing than the natural CASE statement to me:SUM(CASE WHEN VAL1 <> 0 THEN VAL1 ELSE VAL2 END)
VAL1 can return NULL unfortunately so using a...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 31, 2016 at 7:42 am
I doubt the vast majority of developers today have even heard of COBOL, and they certainly have never programmed in it.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 31, 2016 at 7:31 am
Can the addition of an index really cause SQL to produce that bad a plan? Considering it wasn't seeking on that index as far as I could see.
Yes, it can,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 28, 2016 at 4:46 pm
CELKO (10/28/2016)
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 28, 2016 at 1:43 pm
david.jack (10/28/2016)
ScottPletcher (10/27/2016)
Seems more confusing than the natural CASE statement to me:SUM(CASE WHEN VAL1 <> 0 THEN VAL1 ELSE VAL2 END)
VAL1 can return NULL unfortunately so using a comparison operator...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 28, 2016 at 10:48 am
Seems more confusing than the natural CASE statement to me:
SUM(CASE WHEN VAL1 <> 0 THEN VAL1 ELSE VAL2 END)
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 27, 2016 at 10:35 am
You're right. Nvarchar shouldn't be used unless it's needed or realistically could be needed.
For example, if you create a two-character code column, there's no reason to use nvarchar, since...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 26, 2016 at 4:26 pm
For best performance, avoid the separate EXISTS lookup as well:
SELECT O.ow_id
FROM props.dp_owner O
INNER JOIN props.dp_entry E
...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 25, 2016 at 11:58 am
Viewing 15 posts - 4,051 through 4,065 (of 7,613 total)