Viewing 15 posts - 1,141 through 1,155 (of 2,648 total)
Select SourceId, PurchasOrderID, AppearsOn, RowUpdateDateTime,
[1] comment1,
[2] comment2,
...
February 13, 2020 at 10:47 pm
I came up with the following self referencing CTE but its not moving along the levels, so IDK.
With CTE
AS(
SELECT Dimensions,Management,[Description], [Level]
FROM [dbo].[Hier_table]
WHERE Dimensions =...
February 13, 2020 at 11:05 am
Here's a way of writing it without ORs, but I'm not sure it's any better:
WHERE iv.AccountCode = @AccountCode
AND iv.ItemID = @ItemID
AND iv.VarianceID =...
February 10, 2020 at 5:52 pm
WHERE 1 = CASE
WHEN T.record_Key_4 = '1' OR T.Record_Key_5 NOT IN('I', 'X') THEN CASE WHEN PS.popup_gid = 2 THEN 1 eLSE 0 END
ELSE CASE WHEN PS.popup_gid = 5 THEN...
February 7, 2020 at 5:24 pm
You forgot to take into account NULL values. A condition not being true is not the same as the condition being false. It could also be unknown.
Drew
Yes, I was...
February 7, 2020 at 5:00 pm
I'm not sure that all the answers given in this thread are correct?
The WHERE clause, if indented, looks like this:
WHERE 1 = CASE WHEN T.record_Key_4 = '1'...
February 7, 2020 at 4:31 pm
before you ask... you do not want to see the query plan...
Now you've said that, we want to see the query plan.
February 7, 2020 at 3:41 pm
;with A(A) as (select 0 from (values (0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) A(A))
select row_number() over (order by (select null)) ID,
o.quantity,
...
February 6, 2020 at 7:41 pm
This is not as fast as Jeff's method but is a more straight forward way of writing the SQL:
SELECT *
FROM #RMmaster m
WHERE...
February 6, 2020 at 8:55 am
Then how would i calculate the number of loops?
I thought it would be something like [TotalNumberOfRecords] MOD 100000?
Also when i write this value to a SSIS variable, how do...
February 4, 2020 at 11:42 pm
Thanks, Mike. I am also from the UK.
When I Googled 'chad', I ended up learning a lot about a country in Africa, but nothing about hole-punch waste! 🙂
https://en.wikipedia.org/wiki/Hole_punch#Multiple_hole_punches
Most...
February 4, 2020 at 2:45 pm
Jonathan AC Roberts, that's a very good point.
I'm currently Unit testing Phil Parkin's solution, which fits my brief and is elegant to boot.
Thanks for looking.
Giles
Personally I'd just leave it...
February 4, 2020 at 2:27 pm
Why are you outputting this line, whatever the error?
PRINT 'Attempt to insert duplicate PK in dbo.PersonWithUnviewedAlerts';
What if it's caught due to a different error?
February 4, 2020 at 1:46 pm
Looks ok to me. I would only do it with dynamic SQL if the list of tables is going to change. If they are fixed then just hard code an...
February 3, 2020 at 2:25 pm
You could insert the results from each query into a temporary table, then query the temporary table:
CREATE TABLE #Temp
(
TableName sysname NOT NULL
...
February 1, 2020 at 8:05 pm
Viewing 15 posts - 1,141 through 1,155 (of 2,648 total)