Viewing 15 posts - 526 through 540 (of 2,462 total)
Francis Twomey (8/22/2016)
INSERT INTO item_relation_table
(parent__id,
child__id,
relation)
SELECT xm.1_id, xm.2_ID,
'A',
from tablexm xm
where xm.1_id != xm.2_ID and
exists(select 1 from item ip WHERE ip.mfg =...
-- Itzik Ben-Gan 2001
August 22, 2016 at 2:57 pm
This should be fine with SQL Server 2005+
-- sample data
CREATE TABLE #calendarTable (calDate datetime NOT NULL, workingDay char(1) NOT NULL);
WITH base AS
(
SELECT TOP (366)
...
-- Itzik Ben-Gan 2001
August 19, 2016 at 10:19 am
I have a couple ideas I'll play around with when I'm at a PC shortly.
non-nullable Tinyint having (-1,0,1) as possible values
tinyint can't be negative 😉
-- Itzik Ben-Gan 2001
August 19, 2016 at 7:29 am
DentalDBA (8/18/2016)
Does anyone know if Microsoft is thinking about doing away or not supporting database replication in the future? Do they have other ways to copy transaction changes?Thanks
I have...
-- Itzik Ben-Gan 2001
August 18, 2016 at 2:40 pm
My question is would it be better to create a Stage and House for each customer instead of the single method we are doing now? Some of our fact tables...
-- Itzik Ben-Gan 2001
August 18, 2016 at 2:13 pm
... and if we're talking about always doing 3 years behind/ahead of the current year you could even do this:
WITH currentYear AS (SELECT yr = YEAR(getdate()))
SELECT yr = yr +...
-- Itzik Ben-Gan 2001
August 18, 2016 at 11:57 am
The NGRAMS tool you wrote is very cool. Don't blame you a bit. 🙂
😀
-- Itzik Ben-Gan 2001
August 18, 2016 at 11:32 am
The confusing thing about clustered indexes and primary keys is how, by default, SQL server uses the PK columns as the keys for the clustered index when you create a...
-- Itzik Ben-Gan 2001
August 17, 2016 at 2:49 pm
Jeff Moden (8/17/2016)
-- Itzik Ben-Gan 2001
August 17, 2016 at 2:21 pm
Here's a good article by Gail Shaw that discusses Recovery Model internals and has some really good links about what's going on under the hood (if that's what you're looking...
-- Itzik Ben-Gan 2001
August 17, 2016 at 11:54 am
A couple other ways:
1. Use NGrams8K[/url] like so:
DECLARE @price decimal(12,2) = 12345678.90;
SELECT NewPrice =
(
SELECT CASE WHEN token LIKE '[0-9]' THEN CHAR(ASCII(token)+17) ELSE token END
FROM dbo.NGrams8k(@price,...
-- Itzik Ben-Gan 2001
August 17, 2016 at 11:43 am
It's likely that both versions will produce the same execution plan. I would probably go without the CTE because the first query is less complicated. That said, it may be...
-- Itzik Ben-Gan 2001
August 17, 2016 at 11:11 am
This is a classic gaps/islands problem. Have a look at this article:
https://www.simple-talk.com/sql/t-sql-programming/the-sql-of-gaps-and-islands-in-sequences/%5B/url%5D
-- Itzik Ben-Gan 2001
August 16, 2016 at 7:14 am
vsamantha35 (8/15/2016)
-- Itzik Ben-Gan 2001
August 16, 2016 at 7:06 am
That's a mighty big font you got there.
A complete solution will take some time but here's a couple techniques to break your input string into a seperate row for...
-- Itzik Ben-Gan 2001
August 12, 2016 at 11:59 am
Viewing 15 posts - 526 through 540 (of 2,462 total)