Viewing 15 posts - 5,491 through 5,505 (of 10,143 total)
ScottPletcher (10/3/2012)
<<snip>>
I consider 20-30% relatively much slower, particularly given how basic the task was.
A 5 min query then takes ~6+ mins instead. Not tragic, obviously, but significant.
The figures 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
October 3, 2012 at 9:04 am
sayedkhalid99 (10/2/2012)
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
October 3, 2012 at 7:39 am
Koen Verbeeck (10/3/2012)
Brandie Tarvin (10/3/2012)
Koen Verbeeck (9/28/2012)
I know Europe is small, that's why we shipped all the village idiots to another continent to make more room 😀
That would be Australia,...
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
October 3, 2012 at 4:50 am
ScottPletcher (10/2/2012)
Therefore, I suggest using a lookup table, as suggested by others. You absolutely want...
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
October 3, 2012 at 3:45 am
John Mitchell-245523 (10/2/2012)
CREATE TABLE CodeActions (
Code char(4)
,TheActionvarchar(12)
)
INSERT INTO CodeActions (Code,TheAction)
VALUES
('ISSP','Install'),
('IECO','Install'),
('IECM','Install'),
('IESP','Install'),
('IEHD','Install'),
('ISHD','Install'),
('FRSI','Install'),
('SB42','Service Call'),
('SB4W','Service Call'),
('HD42','Service Call'),
('HD4W','Service Call'),
('SA2C','Service Call'),
('SA2W','Service Call'),
('HD2C','Service Call'),
('HD2W','Service Call'),
('SNCO','Service Call')
That way you...
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
October 3, 2012 at 1:51 am
CELKO (10/2/2012)
...NO! We hate UDFs; they are not declarative, do not optimize ...
Nonsense. The OP has explained that (s)he is a novice, Joe, and is willing to learn or wouldn't...
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
October 3, 2012 at 1:50 am
Smash125 (10/2/2012)
;WITH C AS
(
SELECT *,ROW_NUMBER() OVER(PARTITION BY Status ORDER BY Product) AS Rn FROM #TestData
),
C1 AS
(
SELECT *,MIN(Rn)OVER(PARTITION BY Status) MinRn FROM...
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
October 2, 2012 at 9:10 am
Smash125 (10/2/2012)
select Product, MIN(status)
FROM MyCTE
GROUP BY Product
the second column says MIN(status) just wanted to know which...
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
October 2, 2012 at 8:51 am
deepeshdhake (10/1/2012)
I have wrote one store proc. So, in the stored procedure, it is using one table which is in the different database. When I am trying to execute 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
October 2, 2012 at 8:45 am
Eliza (9/30/2012)
Hi all,I have a big long text string that can vary in lengh and contrain audit information about data that has changed in the database...
Thanks
Eliza
Which version of SQL Server...
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
October 2, 2012 at 8:40 am
Change the order of your test data and see of this solution works:
DROP TABLE #TestData
CREATE TABLE #TestData
(
Product NVARCHAR(100),
Parts NVARCHAR(100),
Status NVARCHAR(100)
)
INSERT INTO #TestData(Product,Parts,Status)
SELECT 'Laptop1','mouse','OK' UNION ALL
SELECT 'Laptop1','screen','OK' UNION ALL
...
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
October 2, 2012 at 8:20 am
norbert.manyi (10/2/2012)
ChrisM@Work (10/2/2012)
If you can't code it up as a view, then it's unlikely that you can code it up as a query.
You could still do it as a quite...
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
October 2, 2012 at 8:03 am
norbert.manyi (10/2/2012)
Views would be a better option than functions - coded properly they won't hammer performance quite like the suggested UDF. You can't find a good example right now -...
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
October 2, 2012 at 7:27 am
waqqas.zia (10/2/2012)
Ok so my case statement should always read @jdt_jty_code?
Yes - the @ tells SQL server that the object is a variable. Your scalar UDF works with changes;
create FUNCTION [dbo].[Tester]...
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
October 2, 2012 at 7:23 am
You're better off using inline table-valued functions. Here's an example:
ALTER FUNCTION [dbo].[iTVF_Tester]
(@jdt_jty_code varchar(50))
RETURNS TABLE AS RETURN
SELECT ReturnValue
FROM (VALUES
('ISCO','Install'),
('ISSP','Install'),
('IECO','Install'),
('IECM','Install'),
('IESP','Install'),
('IEHD','Install'),
('ISHD','Install'),
('FRSI','Install'),
('SB42','Service Call'),
('SB4W','Service Call'),
('HD42','Service Call'),
('HD4W','Service Call'),
('SA2C','Service Call'),
('SA2W','Service Call'),
('HD2C','Service Call'),
('HD2W','Service Call'),
('SNCO','Service Call')
) x...
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
October 2, 2012 at 7:19 am
Viewing 15 posts - 5,491 through 5,505 (of 10,143 total)