Viewing 15 posts - 301 through 315 (of 7,608 total)
I don't think you can do much for that table itself.
You need to look at the code that is UPDATEing that table and make sure that code is efficient. Also,...
December 4, 2023 at 6:48 pm
Would you be able to use TRUNCATE TABLE instead to remove all the rows? That will be vastly faster.
If the table has an identity column, and you want to maintain...
November 27, 2023 at 8:04 pm
The inserted and deleted "tables" only exist within the direct code of a trigger. You can't reference them from an external query. You'd need to write the inserted and deleted...
November 25, 2023 at 7:07 pm
This is somewhat confusing, but something like this would likely do what you want to do:
SET ANSI_NULLS ON;
SET QUOTED_IDENTIFIER ON;
GO
CREATE TRIGGER [dbo].[tr_ORDERID]
ON [dbo].[MYCUSTOMERS]
AFTER UPDATE
AS
SET NOCOUNT ON;
BEGIN
IF UPDATE(ORDERID)
BEGIN
...
November 24, 2023 at 2:33 pm
synchronous
November 21, 2023 at 3:52 pm
Code only needs to be schedule on the first and last Thursday of the month, since those are the only 2 days it might need to do something.
As to simplification,...
November 21, 2023 at 2:35 pm
The worst schema I had to implement: A customer wanted us to reboot the server for patches on the first friday of the month around 1am.
How do you...
November 20, 2023 at 3:54 pm
(Dup post, removed)
November 16, 2023 at 3:04 pm
;WITH cte_data AS (
SELECT CAST(50.10 AS numeric(5, 2)) AS HRS
UNION ALL
SELECT 50.77
)
SELECT HRS
FROM cte_data
WHERE HRS...
November 16, 2023 at 3:03 pm
LineCount must exist in your table, not the system table; if so, then change the alias before the column name:
...
INSERT INTO dbo.PrimaryHist
SELECT 'UPDATE'
,s.login_name
,i.batch_id
,i.LineCount --<<--
FROM INSERTED AS i
CROSS JOIN sys.dm_exec_sessions AS...
November 16, 2023 at 3:14 am
Page compression is generally very effective at reducing data size. But you will need to either: (1) shrink the data file after compressing, which will take a long time and...
November 16, 2023 at 3:11 am
That's the equivalent of a CROSS JOIN:
SELECT 'UPDATE'
,s.login_name
,i.batch_id
FROM INSERTED AS i
CROSS...
November 15, 2023 at 9:44 pm
Or, just in case there might be: '64.0 MB,restricted growth to 2097152.0 MB'
SELECT * FROM #tbl_datafile_list WHERE Autogrow LIKE '%[^A-Za-z]restricted[^A-Za-z]%'
November 7, 2023 at 3:01 pm
Triggers don't necessarily suck at performance, it depends on how they are written. Neither does CDC perform all that poorly; in fact, I think it's extremely unlikely you could write...
November 2, 2023 at 9:03 pm
;WITH cte AS (
SELECT @@SERVERNAME AS ServerName,
ISNULL(b.database_name, d.name) AS DatabaseName,
...
November 2, 2023 at 5:20 pm
Viewing 15 posts - 301 through 315 (of 7,608 total)