Viewing 15 posts - 5,401 through 5,415 (of 8,731 total)
Note how the duplicates in the column Tdl_Id generate more rows with your code. You can also check the difference between execution plans (which correlates directly to the code).
December 15, 2014 at 5:31 pm
Based on the logic that I can understand from your query, you wouldn't even need derived tables. Look at how I'm posting DDL and sample data, you're supposed to post...
December 15, 2014 at 5:28 pm
There's a different method but with up to 200 databases the validations can become complex and the improvement is unnoticeable. This is one of those occasions where a cursor is...
December 15, 2014 at 5:13 pm
You can try using common table expressions.
However, your example shows that you're using the same table over and over again joined by the same key. That's only a recipe for...
December 15, 2014 at 4:18 pm
This is an idea on how to do it. It's not perfect as the NULLS will be sorted first. I'm sure that you'll be able to handle that.
DECLARE @RowCount ...
December 15, 2014 at 4:12 pm
Why do you want to count before truncation? That would only slow you down. Additionally to that, you can't use variable values as table names unless you use dynamic SQL....
December 15, 2014 at 11:23 am
It seems to me that you don't need a cursor (or worse, nested cursors). This could be accomplished with direct queries.
However, as Steve told you, we need DDL and sample...
December 15, 2014 at 10:30 am
Yet another version taking the advantage of preaggregation used by Jason and single table scan from Michael.
WITH preAggregation AS(
SELECT WIP_master.uompScheduleNumber
,CASE WIP_master.uompScheduleColor
...
December 15, 2014 at 10:22 am
You can read the following articles about cross tabs:
You might need to use ROW_NUMBER() to create "constant" values and MAX() to "aggregate" the data.
December 12, 2014 at 4:59 pm
mhildebrand (12/12/2014)
One voucher paying several vendors and invoices is quite normal. The problem is that you have 2 tables, one defines a relationship between voucher, vendor and invoice and the...
December 12, 2014 at 12:31 pm
mhildebrand (12/12/2014)
December 12, 2014 at 11:49 am
Help me out here. You posted several rows with the same voucher number on both tables. That would create a cartesian product and give incorrect results. Is this correct? You...
December 12, 2014 at 11:30 am
mhildebrand (12/12/2014)
December 12, 2014 at 10:36 am
You just need a single CASE.
SELECT CASE
WHEN PT.datatype = 7 AND MVA.DateTimeValue IS NOT NULL
...
December 12, 2014 at 10:02 am
Viewing 15 posts - 5,401 through 5,415 (of 8,731 total)