Viewing 15 posts - 2,356 through 2,370 (of 7,614 total)
I'd forget recursion for this for now, maybe try a more "loopy" approach:
USE tempdb;
DROP TABLE IF EXISTS dbo.objectLinks;
CREATE TABLE dbo.objectLinks (
UniqueID int IDENTITY(1,1) NOT...
August 4, 2020 at 4:13 pm
I don't see a more efficient way. The speed problem may be that it ise UPDATEing every row of the Brs table, since there's no join to it in the...
August 3, 2020 at 3:14 pm
I thought LEAD / LAG were added in SQL 2012?!, although I'm not sure how useful they'd be here anyway.
July 31, 2020 at 10:31 pm
DROP TABLE IF EXISTS #testdata;
CREATE TABLE #testdata ( description nvarchar(max) NULL, new_description nvarchar(max) NULL );
INSERT INTO #testdata ( description) VALUES
('Hyperlink[https://OldURL/Site/location.doc?andnowuneededstuff]'),
...
July 31, 2020 at 10:06 pm
Not 100% sure what you are ultimately trying to do, but maybe something like this:
...
SET DESCRIPTION = REPLACE(CAST(DESCRIPTION AS nvarchar(max)), N'.doc?', N'?web=1')
...
July 31, 2020 at 6:04 pm
It's vital to insure that these backups are securely encrypted. Highly sensitive data going to a removal drive would be a very bad practice otherwise.
July 30, 2020 at 9:26 pm
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
Viewing 15 posts - 2,356 through 2,370 (of 7,614 total)