Viewing 15 posts - 46 through 60 (of 423 total)
Here is a sample of how to DELETE or update all but the first row
-- delete all duplicates but first in each set
WITH cte AS
May 30, 2017 at 1:21 pm
You will drive yourself insane processing this in days and hours. By viewing shift times as offsets in minutes from Sunday 12 am everything will become super easy.
May 22, 2017 at 3:07 pm
CREATE function dbo.MaskWeekdays
(
@Mask varchar(8)
)
returns
@DayNumbers TABLE (DayNumber int not null)
as
BEGIN
if SUBSTRING(@Mask,1,1) = 'M' INSERT INTO @DayNumbers (DayNumber) VALUES(2);
if...
May 19, 2017 at 10:10 am
Maybe create a function that parses the mask and returns a table of day numbers. That table can be joined to any query to return just the days you want.
May 19, 2017 at 9:54 am
I find this easier to read rather than dozens of "is null" lines:
DECLARE @c1 int, @c2 int, @c3 int, @c4 int;
--SET...
May 19, 2017 at 8:57 am
My biggest mistake was 10 years ago when I emailed an employee about 46,000 alerts due to an infinite loop.
-- infinite loop example
DECLARE @t...
May 18, 2017 at 5:50 am
Personally, I would never say all clustered indexes are unique. It is a philosophical issue but I believe Grant's statement will mislead all beginners. Technically everything in the universe is...
May 16, 2017 at 5:42 am
I've seen dozens of sql servers with tempdb set to initial sizes of 8MB data and 1MB log with Autogrowth rates of 1MB and no maxsize set. This must cause...
April 27, 2017 at 12:39 pm
Hmm, I think coming up with a creative solution...is too big of an approach.
Humanity advances by creating better and more efficient tools (think hammer versus rock). When I...
April 21, 2017 at 2:50 pm
DECLARE @tData TABLE
(
nArticle_Id int not null,
nRev_Id int not null PRIMARY KEY,
dStart datetime2 not null,
dEnd datetime2 null
);
INSERT into @tData
VALUES
April 20, 2017 at 11:51 am
There is a fine line between "trick" and "hack". This cool function is using lots of side effects which makes me wonder if it might become SQL Server version dependent...
April 18, 2017 at 8:40 am
select orderdate from QuartzReportnew where orderdate >= '12/04/2017' AND orderdate < '12/05/2017';
April 18, 2017 at 7:22 am
Without any connection to SQL Server it is tough to debug. About the only thing you have access to is to view the errorlog in notepad. It will list your...
April 17, 2017 at 2:22 pm
Give developers a "play" database with no security. Create a "Development" database where they can only change data while all structural changes must go through you so the team is...
April 14, 2017 at 11:38 am
After applying 90 security updates and restarting the host I could not connect to the named instance without specifying the port. I went back into the "Windows Firewall with Advanced...
April 13, 2017 at 7:59 am
Viewing 15 posts - 46 through 60 (of 423 total)