Viewing 15 posts - 76 through 90 (of 7,545 total)
My main advice would also be not to modify the table structure unless you really need to (I deliberately put the code in comments that (if you wanted to) changed...
July 24, 2024 at 9:37 pm
It's nice that there's already an index on dDateIn. I would suggest something like this:
--Setup
(A1) Create a new table, with a usable clustered index. Add data compression to the table...
July 24, 2024 at 7:26 pm
If the table is just a heap (you said there's no PK, but that doesn't necessarily mean there's no clustered index), as you know, you'll have to rewrite the whole...
July 24, 2024 at 4:02 pm
I think if you do the UPDATE and lookup all in one go, you won't have dups nor deadlocks:
...
UPDATE dbo.Reference_Numbers
SET @NextReferenceNo = NexNextReferenceNo = NextReferenceNo + 1...
July 24, 2024 at 3:25 pm
No. If they're sleeping, and don't have any active tasks, they are not using up CPU. They are taking a small amount of memory.
July 16, 2024 at 5:35 pm
I've generally found MERGE to be less efficient than UPSERT. Others maybe not.
You could generate the necessary WHERE clauses and CASE clauses to conditionally UPDATE 200 columns.
July 11, 2024 at 10:09 pm
Because * SELECTs all columns, which would include hMy. Try this instead:
SELECT hMy, *
FROM dbo.WF_HEADER
WHERE 1=1
ORDER BY 1 --<<--
July 8, 2024 at 9:47 pm
For one thing, don't force only LOOP joins, YIKES!
To tell you anything else, would need much more details on the tables and parameters.
July 8, 2024 at 8:20 pm
The data seemed inconsistent / "impossible" to me. How can the left-most 50 bytes be '3006' when that doesn't appear in the original value at all??
July 3, 2024 at 9:46 pm
Don't do online, do offline. That should be ok if you have scheduled down time anyway.
Otherwise, hard to say without more details. As stated above, you may not really need...
July 2, 2024 at 1:45 pm
SELECT DISTINCT UPC, STARTDATE, [MASTERCHAINNAME], REPLENTYPE,
CASE WHEN [REPLENTYPE] IS NULL THEN 'Not in CKB'
WHEN [REPLENTYPE] = 'NONE' THEN 'Non Replenishable'
ELSE 'Replenishable' END AS 'Replentype'
FROM dbo.tablename t1
WHERE...
July 1, 2024 at 9:58 pm
Select TBL1.caseid, TBL1.anotherid, TBL2.locked
From atable1 AS TBL1
JOIN atable2 AS TBL2 ON atable2.caseid = atable1.caseid
where TBL1.date Between CAST('2021-03-19' as Date) and CAST('2023-03-30' as Date)
and not exists(select * from atable2 AS TBL2 ...
July 1, 2024 at 6:13 pm
You just need a NOT EXISTS in the original query, but can't be coded accurately without knowing which columns are in which table(s).
July 1, 2024 at 5:58 pm
That query can't run, because you didn't specify which "caseid" in the SELECT.
We have NO way to know which column(s) are in which tables. You need to alias EVERY column...
July 1, 2024 at 3:50 pm
Assuming that AVALUE is based on the ID value (that is, the same ID always has the same AVALUE), then you can leave AVALUE out of the GROUP BY. If...
June 28, 2024 at 5:50 pm
Viewing 15 posts - 76 through 90 (of 7,545 total)