Viewing 15 posts - 1,156 through 1,170 (of 1,228 total)
SELECT 'step1' AS Step, tab1.*, tab2.*
FROM tab1
INNER JOIN tab2 ON tab2.postalCode = tab1.postalCode
UNION ALL
SELECT 'step2' AS Step, tab1.*, tab2.*
FROM (
SELECT tab1.*
FROM tab1
LEFT JOIN tab2 ON tab2.postalCode = tab1.postalCode
WHERE tab2.postalCode IS...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 17, 2010 at 2:38 pm
In addition to the corrections which Lynn pointed out:
If @CurrentPartNumber<>@PartNumber
begin
--Do something
...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 17, 2010 at 12:50 pm
lmu92 (2/13/2010)
ChrisM@home (2/13/2010)
lmu92 (2/13/2010)
And here's what I came up with (@ Chris: yes, a bunch of CTE's again :-D)Who needs CTE's? 😛
Maybe someone who looks at execution plans and wonder...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 13, 2010 at 11:54 am
Tim Januario-145496 (2/13/2010)
You actually can't do what you are trying to do very easily.
You can, and it looks ok, but you wouldn't want to;
DECLARE @CurveId varchar(60)
SET @CurveId = ','...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 13, 2010 at 10:48 am
Hi Elias
Thanks again for testing this out. It's a good improvement, but still way short of expectations. Looks like time for plan B :blush:
May I suggest you send me a...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 13, 2010 at 9:51 am
surya-434952 (2/12/2010)
Hi i have two tables Periods
A single date doesn't constitute a period. I've assumed that a "period" is represented (in the periods table) as follows:
startdate is the date...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 13, 2010 at 5:25 am
lmu92 (2/13/2010)
And here's what I came up with (@ Chris: yes, a bunch of CTE's again :-D)
Who needs CTE's? 😛
SELECT p.PeriodStart, p.PeriodEnd, da.Dept, da.Acct,
ISNULL(s.[Date], p.PeriodEnd), ISNULL(s.Credit, 0) AS Credit,...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 13, 2010 at 5:14 am
Hi Elias
Here's version 2. The facility string store has been removed and replaced with conventional processing. Collateral balances are only stored when they need to be, and are removed when...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 13, 2010 at 4:55 am
Please edit and correct your sample data script. There's a UNION ALL on the last SELECT for #periods, when this is corrected there are further errors:
Msg 207, Level 16, State...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 13, 2010 at 2:29 am
Luckbox72 (2/12/2010)
SET @query=
'SELECT * Into #tempTable FROM
(SELECT RepID, State
FROM RepBDState) src
PIVOT (count(State) FOR State IN ('+@listCol+')) AS pvt'
EXECUTE (@Query)
select * from #tempTable
and when run I get the following
(236...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 12, 2010 at 3:21 pm
Jeff Moden (2/12/2010)
@sqlserver12345,Any feedback on this? Did any of this work for you?
This is what happens when candidates are left alone in a room with a written test and...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 12, 2010 at 3:07 pm
Hi Elias
Thanks for giving it a try. "Make it work, make it fast, make it pretty". There's plenty of scope for improvement.
Firstly, as you suggest, perhaps only one string store...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 12, 2010 at 2:35 pm
Dupe = ROW_NUMBER() OVER(PARTITION BY Col1 Col2 Col3 Col4 Col5 Col6 ORDER BY Col1 Col2 Col3 Col4 Col5 Col6 Col7)
If you set up your sample as a CREATE TABLE...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 12, 2010 at 2:05 pm
Hi Elias
Thanks for being so patient.
Don't forget - always test.
-- data setup
DROP TABLE #Working
DROP TABLE #zzzCovers
CREATE TABLE #zzzCovers(
[CollateralID] [nvarchar](50) NOT NULL,
...
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 12, 2010 at 8:01 am
Lynn Pettis (2/11/2010)
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
February 11, 2010 at 3:07 pm
Viewing 15 posts - 1,156 through 1,170 (of 1,228 total)