Viewing 15 posts - 4,381 through 4,395 (of 10,143 total)
GilaMonster (7/15/2013)
ChrisM@Work (7/15/2013)
Edit - removed RESULTNUMBER, it's the cluster key.Why? What if someone changes the clustered index?
It won't matter if OP creates the index I suggested. Since it's covering,...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 15, 2013 at 5:03 am
If you find the time to create the index I suggested, I'd be interested in seeing the execution plan 😉
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 15, 2013 at 4:46 am
ananda.murugesan (7/15/2013)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 15, 2013 at 3:41 am
ananda.murugesan (7/14/2013)
thanks for reply... I got the result 00:00:00 seconds after update stats in NC Clustred Index in RESULT Table..
Can you post the actual plan?
Joins in the WHERE clause are...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 15, 2013 at 2:31 am
Drop the table variables altogether:
SELECT
a.MemberId,
a.SortOrder ,
a.Status ,
a.ReasonCD ,
a.Active,
r.Rid,
r.RType,
r.Sensitive,
r.Weight,
r.ROI,
r.Program,
r.Mgmt_Ranking,
r.Significant,
(select top 1 Name from library WITH (NoLock)
where rID = r.ruleid) as ruleName,
min(b.analysisasofdate) initiallyIdentified,
max(b.analysisasofdate) mostRecentlyIdentified,
a.category,
v_cnt.ResponseCategoryCount,...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 8:30 am
mister.magoo (7/12/2013)
use temporary tables with good indexes
And use temporary tables with columns which match the joins in the query:
inner join @alerts a on a.ruleid = r.ruleid
and a.alertbatchid =...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 8:11 am
Hi Kath, welcome to ssc!
-- unless you are checking for NULL,
-- referencing a column from an OUTER-joined table
-- will turn the join into an INNER join
-- Here's the...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 6:18 am
kapil_kk (7/12/2013)
Thanks Chris :-),In past also you make me learn Tally table n many things, its my pleasure to learn new things from you always.. :-P:-D
You're welcome! I learn something...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 4:16 am
kapil_kk (7/12/2013)
Will this query be work in this manner..
If a voucher is 'Active at Ho' or its status is 'Dispatched' it is correct...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 3:51 am
Here are queries 3 and 4 condensed in the same way;
SELECT gv.VoucherBookletNo
FROM GV_Voucher v
INNER JOIN GV_VoucherStatus gvs
ON v.VoucherStatusId = gvs.VoucherStatusId
WHERE v.VoucherNo = @Lastvoucher
AND (
(gvs.VoucherStatus =...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 3:41 am
You can replace the first two queries with one query:
SELECT gv.VoucherNo
FROM GV_Voucher As gv
INNER JOIN GV_VoucherStatus gvs
ON gv.VoucherStatusId = gvs.VoucherStatusId
AND gvs.VoucherStatus = 'Active at HO'
WHERE gv.VoucherNo...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 3:32 am
Rearrange the first two queries like so:
IF EXISTS
(
SELECT gv.VoucherNo
FROM GV_Voucher As gv
INNER JOIN GV_VoucherStatus gvs
ON gv.VoucherStatusId = gvs.VoucherStatusId
AND gvs.VoucherStatus = 'Active at HO'
INNER JOIN GV_ReceivedOffice...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 3:28 am
asifejaz (7/12/2013)
it decrement the first row successfully. when moving to second row instead of decrementing it to one it decrements it to two , then to...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 1:38 am
DROP table tbl
CREATE TABLE tbl
(ID int identity, Voucherno varchar(10), numstatus varchar(10)
)
INSERT INTO tbl VALUES
('V0001','Active'),
('V0002','Active'),
('V0003','Active'),
('V0004','InActive'),
('V0005','Active')
DECLARE @firstno varchar(10) = 'V0001',
@scndno varchar(10)...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 1:35 am
asifejaz (7/12/2013)
8 months.:angry:
Don't worry, you'll get the hang of it - quicker, if you can attract the attention of someone here on ssc who's in your time zone 😀
Any questions...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
July 12, 2013 at 1:01 am
Viewing 15 posts - 4,381 through 4,395 (of 10,143 total)