Viewing 15 posts - 6,436 through 6,450 (of 10,143 total)
Usman Butt (12/1/2011)
ChrisM@Work (12/1/2011)
SELECT
ItemCode,
Column1 = MAX(CASE WHEN YearShipped = 2010...
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
December 1, 2011 at 3:38 am
Use a crosstab, preaggregating the raw table with either a CTE or a derived table. Here's the derived table version:
SELECT
ItemCode,
Column1 = MAX(CASE WHEN YearShipped = 2010 AND MonthShipped =...
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
December 1, 2011 at 2:43 am
Denise McMillan (11/30/2011)
select number, avalue, (select x.nvalue from valuestbl as...
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
November 30, 2011 at 10:26 am
Hey Jon, thanks loads for posting up sample data - it took a moment to tweak the script but no worries. Try this:
;WITH CTE AS (
SELECT
ID,
ProjectID,
rowDescription,
[Year],...
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
November 30, 2011 at 7:54 am
Hi Jon, welcome to the forum.
Can you post up some sample data? There's a link in my sig which shows how to do this - well worth a read for...
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
November 30, 2011 at 6:57 am
alaguganesha1983 (11/30/2011)
T-SQL , Stored Procedures & Performance Tuning:I need clear idea and good example for the above topic i mentioned.
help me with this please.
Acquiring sufficient experience, knowledge and understanding of...
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
November 30, 2011 at 2:31 am
ashkan siroos (11/29/2011)
I have Changed my query to avoid cross apply because of the efficiency ...
CROSS/OUTER APPLY can be surprisingly efficient - read the excellent articles written by Paul White,...
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
November 30, 2011 at 2:09 am
FROM
.
.
.
CROSS APPLY (
SELECT poi.POIDescription, rn = ROW_NUMBER() OVER(ORDER BY r.RequestCode desc)
FROM DMSRequestDocListTbl rdl
INNER JOIN DMSRequestTbl r
ON rdl.RequestCode = r.RequestCode
AND r.RequestTypeID in ( 8,9)
AND r.DocRevID = @DocRevID...
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
November 29, 2011 at 10:02 am
Try using Cross/Outer Apply.
You can easily convert the content into an inline TVF.
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
November 29, 2011 at 6:45 am
Using a temp table containing the PK's of the target table looks like the best option to me:
SELECT sec_no
INTO #sec_no_to_delete
FROM sec_returns m
WHERE NOT EXISTS (
SELECT 1
FROM sec_returns
WHERE...
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
November 29, 2011 at 3:59 am
Evil Kraig F (11/22/2011)
SQLRNNR (11/22/2011)
riddleQuestion Mark
Mark is innocent!
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
November 29, 2011 at 3:25 am
Jorge Lopes (11/28/2011)
SELECT 'Balanço[space][space]ANO'
CREATE TABLE #desc
( NAME VARCHAR(100))
INSERT INTO #desc
SELECT...
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
November 28, 2011 at 10:30 am
DROP TABLE #desc
CREATE TABLE #desc
( NAME VARCHAR(100))
INSERT INTO #desc
SELECT 'Balanço- Activo não corrente' UNION ALL -- note changed position of hyphen
SELECT 'Balanço - Autonomia Financeira' UNION ALL
SELECT 'Balanço ANO'
SELECT
NAME,...
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
November 28, 2011 at 4:01 am
Character position 9 of two of your strings is a hyphen. There are ways to get around this, for instance you could remove the hyphen and a white space using...
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
November 28, 2011 at 3:53 am
Run this query, describe the result set - better still, post the result set:
SELECT YEAR(OrderDate) AS OrderYear,
AVG(TotalDue) AS TotalDue
FROM Sales.SalesOrderHeader
GROUP BY YEAR(OrderDate)
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
November 25, 2011 at 7:42 am
Viewing 15 posts - 6,436 through 6,450 (of 10,143 total)