Viewing 15 posts - 2,356 through 2,370 (of 7,608 total)
Well good luck. I would hate to have to look at actual physical data pages to do data comparisons -- and I'm a long-time DBA!
It wasn't too bad having to...
July 29, 2020 at 8:22 pm
> I need to generate some events when an insert or delete occurs and this system needs to be pluggable to any SQL database. <<
Presumably you would want to do...
July 29, 2020 at 8:01 pm
If the entire file is less than 2GB, I suggest BULK IMPORTing the file into a single CLOB. Then use DelimitedSplit8K to separate it into rows (assuming each row is...
July 29, 2020 at 7:09 pm
No, you cannot access nor specify the "uniquifier" value added by SQL Server.
Often it's best just to use identity or some other value to insure uniqueness yourself, and you would...
July 29, 2020 at 5:00 pm
Be careful, there could be a lot of matching rows for that query.
I think you need to specify that you want the first work date only. I also have not...
July 28, 2020 at 4:22 am
Hi,
Please refer below code snippet -
;WITH DateTable AS (
SELECT * FROM (VALUES
('2020-07-01',0,0),
('2020-07-02',0,0),
('2020-07-03',0,1),
('2020-07-04',1,0),
('2020-07-05',1,0),
('2020-07-06',0,0),
('2020-07-07',0,0),
('2020-07-08',0,0)
) AS t(DateValue,isWeekEnd,isHoliday)
),
TicketTable AS (
SELECT * FROM (VALUES
('Ticket1','2020-07-01','2020-07-06'),
('Ticket2','2020-07-07','2020-07-08'),
('Ticket3','2020-07-07',NULL)
) AS t(Ticket,CreateDate,ResolvedDate)
)
SELECT t.Ticket,t.CreateDate,t.ResolvedDate,
DATEDIFF(DAY,t.CreateDate,t.ResolvedDate)...
July 28, 2020 at 4:12 am
>> from master..spt_values <<
Referencing master db like that is a horrible idea, just stop doing it. It's very easy instead to create your own inline table.
July 24, 2020 at 4:24 pm
I have separate work_day and nonwork_day tables, for assorted reasons, including that I think it is simpler and very efficient (esp. when I need to see only nonwork days). Code...
July 23, 2020 at 4:12 am
Hi,
Please refer below code snippet -
;WITH DateTable AS (
SELECT * FROM (VALUES
('2020-07-01',0,0),
('2020-07-02',0,0),
('2020-07-03',0,1),
('2020-07-04',1,0),
('2020-07-05',1,0),
('2020-07-06',0,0),
('2020-07-07',0,0),
('2020-07-08',0,0)
) AS t(DateValue,isWeekEnd,isHoliday)
),
TicketTable AS (
SELECT * FROM (VALUES
('Ticket1','2020-07-01','2020-07-06'),
('Ticket2','2020-07-07','2020-07-08'),
('Ticket3','2020-07-07',NULL)
) AS t(Ticket,CreateDate,ResolvedDate)
)
SELECT t.Ticket,t.CreateDate,t.ResolvedDate,
DATEDIFF(DAY,t.CreateDate,t.ResolvedDate) - SUM(d.isWeekEnd)-SUM(d.isHoliday) AS...
July 22, 2020 at 3:39 am
Be sure to specify NULL rather than letting nullability default, because the default might be NOT NULL, which would cause an error.
ALTER TABLE #Test2
ADD D int NULL;
July 22, 2020 at 3:37 am
Something like below. It looks the original trigger is an INSTEAD OF INSERT and AFTER UPDATE at the same time. SQL Server doesn't allow you to define them together. If...
July 22, 2020 at 3:26 am
The pages might "bubble up" one at a time, but that has nothing to do with a "bubble sort", which requires vastly more RAM / storage.
Also, it seems to that...
July 20, 2020 at 6:07 pm
But, yes, depending in which way your index is disorganised, REORGANIZE can mean a lot of operations, as it performs a bubble sort of the file.
I don't think so. ...
July 20, 2020 at 2:40 pm
Something like this:
SELECT A.TicketID, A.Status, A.CreatedDate, A.ResolvedDate,
(SELECT COUNT(*) FROM dbo.Date_Table DT
WHERE DT.Date >= A.CreatedDate AND DT.Date >=...
July 20, 2020 at 2:35 pm
;WITH cte_date_calcs AS (
SELECT
CASE WHEN todays_day >= 16
...
July 17, 2020 at 7:36 pm
Viewing 15 posts - 2,356 through 2,370 (of 7,608 total)