Viewing 15 posts - 496 through 510 (of 2,645 total)
SELECT TrId, SellPrice, kode, DiffAmt,
SellPrice + SUM(DiffAmt) OVER (ORDER BY TrId ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS Rtotal
FROM #tmp
February 23, 2023 at 1:06 am
Create some test data:
DROP TABLE IF EXISTS TestTable
GO
CREATE TABLE TestTable
(
NoSeqTrt INT,
NoSeqIti INT,
idPointsrv INT
)
;
GO
-- Populate TestTable...
February 22, 2023 at 6:39 pm
Deleting does not directly cause a page split but after a delete there might not be enough space for a new row to be inserted, so it might indirectly cause...
February 22, 2023 at 1:17 pm
YES! And the elapsed time will change more than CPU time on a production server with many users.
I hope I don't sound too critical but that's not really true,...
February 22, 2023 at 2:19 am
Try to look at the CPU time
Try looking up the word faster.
February 22, 2023 at 2:10 am
I use your script and just show the result.
Ok data setup with the following rows:
insert into dbo.t1
select t.N, SUBSTRING(CONVERT(varchar(40), newid()), 1, 10)
from dbo.fnTally(1,10000000) t;
insert into dbo.t2
select...
February 22, 2023 at 1:57 am
Here is a test that shows using a separate MERGE is faster than a UPDATE/INSERT.
If you change your data to a more realistic scenario, you will come to the...
February 22, 2023 at 12:32 am
I found this to work perfectly:
where ServiceDate between DATEADD (mm, DATEDIFF (mm, 0, GETDATE ()) - 1, 0) and
dateadd (dd, -1,...
February 21, 2023 at 7:42 pm
I don't understand how you get to those results, can you attach the spreadsheet with some data and the formula?
February 20, 2023 at 5:31 pm
Here is the code produced by ChatGPT
SELECT *
FROM your_table
WHERE date_column >= DATEADD(month, DATEDIFF(month, 0, GETDATE()) - 1, 0)
AND date_column...
February 20, 2023 at 4:37 pm
Here is a test that shows using a separate UPDATE/INSERT is faster than a MERGE.
SET STATISTICS IO, TIME OFF
if object_id('dbo.t1','U') IS NOT NULL drop table dbo.t1;
if object_id('dbo.t2','U')...
February 20, 2023 at 12:31 pm
Sorry, but this script won't work well for large tables, especially with heavy use of IN() and NOT IN() operators. MERGE is usually faster than series of consecutive INSERT/UPDATE/DELETE...
February 20, 2023 at 10:02 am
Jeff Moden wrote:I'm kinda curious why anyone thinks that a separate overtime table is needed at all.
Well it can't go in the Employee table.
Heh... Ya think? 😀
Why is there...
February 20, 2023 at 1:59 am
I'm kinda curious why anyone thinks that a separate overtime table is needed at all.
Well it can't go in the Employee table.
February 20, 2023 at 1:26 am
I think you just need one table with
Overtime
ID (primary key)
EmployeeId (foreign key referencing the Employee table)
OvertimeDate
OTypeID ("D", "FoN", or "FN")
OvertimeHours
February 20, 2023 at 12:51 am
Viewing 15 posts - 496 through 510 (of 2,645 total)