Viewing 15 posts - 3,646 through 3,660 (of 7,609 total)
When joining to do UPDATEs, always update the table alias not the table name itself. Otherwise you could have the same problem (or other problems).
UPDATE ...
December 14, 2017 at 10:20 am
Specifically what row selection conditions do you want? Your sample is not clear. But you almost certainly don't need CASE in any event.
It sounds like you may actually...
December 12, 2017 at 3:01 pm
Could you provide actual test data, as CREATE TABLE and INSERT statements, rather than just a picture of data. We can't write code against a picture .🙂
December 12, 2017 at 2:50 pm
There's no need to join the group row to itself, so this is another possibility:
SELECT c.*
FROM #companies c
LEFT OUTER JOIN #companies g
...
December 8, 2017 at 9:12 am
If the values are integers, I don't see the need to involve date conversions/char stringing at all:
SELECT yyyymm1, yyyymm2, (yyyymm2 / 100 * 12 +...
December 8, 2017 at 9:06 am
For those indexes, you could drop both index1 and index2.
December 7, 2017 at 7:42 am
December 7, 2017 at 7:37 am
/* this block should only get executed on the first iteration */
DECLARE @greeting VARCHAR(100);
SET @greeting = 'Hello';
/* ==================== */
/* I want this block...
December 6, 2017 at 3:30 pm
FYI, fwiw, there's some slight differences in the sample data being used and the original sample data picture. Here's the adjusted data:
INSERT INTO...
December 6, 2017 at 12:49 pm
I allow my instances to auto-parameterize, so if it's that valuable to the plan, presumably SQL will do so anyway.
Again, with dynamic SQL specifically -- which this code...
December 4, 2017 at 2:45 pm
December 4, 2017 at 12:59 pm
Viewing 15 posts - 3,646 through 3,660 (of 7,609 total)