Viewing 15 posts - 1,141 through 1,155 (of 1,228 total)
shawndidy (2/21/2010)
I need to randomly select questions my database. i used the following query:
...
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 21, 2010 at 3:18 am
Rather than aggregating and analysing your data in a single step, run a full-speed preaggregate, then analyse the results. All that CASEing and SUMing one row at a time will...
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 21, 2010 at 2:45 am
Paul White (2/20/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 21, 2010 at 2:14 am
GilaMonster (2/20/2010)
ChrisM@home (2/20/2010)
Can you please confirm which version of SQL Server you are using?Chris Kitchen (2/20/2010)
I'm running SQL Server 2000 Enterprise Edition on Win2k3 Enterprise Edition
D'oh, thanks Gail.
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 20, 2010 at 12:28 pm
Chris
If this seems way too obvious then I apologise beforehand - table variables can very often be directly swapped out for derived tables which the optimiser knows and understands.
Are...
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 20, 2010 at 11:59 am
@ Matt: until I've posted evidence to support this statement, consider it retracted with humble apologies.
Here's where it started, some messing about with CROSS APPLY - note that this query...
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 20, 2010 at 11:17 am
Matt Miller (#4) (2/20/2010)
ChrisM@home (2/20/2010)
Paul White (2/20/2010)
UsingChrisM'sArun's super test-data script, the following appeals to me:snip
'Course it does, it's got a CROSS APPLY in it!:hehe:
CROSS APPLY is an awesome...
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 20, 2010 at 9:54 am
sachin1sharma (2/20/2010)
thanks for your awesome replies and suggestions but i think i myself got deviated from the original requirement. Below is what I actually need.
select * from #tmp_Dates_Notional
-- The desired...
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 20, 2010 at 7:21 am
Paul White (2/20/2010)
UsingChrisM'sArun's super test-data script, the following appeals to me:snip
'Course it does, it's got a CROSS APPLY in it!:hehe:
CROSS APPLY is an awesome operator to use for...
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 20, 2010 at 4:43 am
Hi Arun
Follow the link to Jeff Moden's article in Wayne's post above. The article explains in great detail how to perform the quirky update and also identifies those situations where...
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 20, 2010 at 4:09 am
Here's a CTE solution to this problem - just the SELECT, but easy enough to use as the input for an UPDATE FROM:
;WITH NumberedSet AS (
SELECT RowNum = ROW_NUMBER() OVER...
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 20, 2010 at 3:36 am
arun.sas (2/20/2010)
nice move with inner join.
But the situation always not with max date
UPDATE t
SET t.date2 = (SELECT MAX(date2) FROM #temp WHERE date2 <= t.date1)
from #temp t
However, you should see...
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 20, 2010 at 3:09 am
GT-897544 (2/20/2010)
ziangij (2/19/2010)
i just checked it out.. without indexes, update query takes 30 sec.
with the indexes in places, it takes 2 min !
RBarryYoung (2/17/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 20, 2010 at 2:49 am
DROP table #temp
create table #temp
(
date1 datetime null,
date2 datetime null
)
insert into #temp (date1,date2)
select '2009-01-01','2009-01-01' union all
select '2009-01-02',null union all
select '2009-01-03',null union all
select '2009-01-04',null union all
select '2009-01-05','2009-01-05' union all
select '2009-01-06',null union all
select...
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 20, 2010 at 2:35 am
Hamid-Sadeghian (2/16/2010)
No.This is a real number.Because this number is referenced.When Accountant archive voucher this number is reference in the archive.
Voucher number is a business entity, it could just as easily...
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 3:35 pm
Viewing 15 posts - 1,141 through 1,155 (of 1,228 total)