Viewing 15 posts - 316 through 330 (of 1,228 total)
garyh2k3 (8/13/2013)
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]
August 13, 2013 at 12:57 pm
Which post, Gary?
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]
August 13, 2013 at 9:47 am
Post the actual execution plan for the query as a .sqlplan attachment.
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]
August 13, 2013 at 9:46 am
Could it be as simple as this?
SELECT
s.Space_Number,
MIN(e.First) AS First1,
MIN(e.Last) AS Last1,
MAX(e.First) AS First2,
MAX(e.Last) AS Last2,
MIN(e.CC) AS FirstOfCC,
MIN(e.[Employee Type]) AS [FirstOfEmployee Type],
s.[Space Type]
FROM...
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]
August 12, 2013 at 1:32 pm
Chris, can you post the CREATE VIEW statement? Better still, can you post an actual execution plan (as a .sqlplan attachment) of a select from the 'slow' view?
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]
August 12, 2013 at 1:25 pm
SELECT
NDCNumber,
IngredientCost = CAST(CASE
WHEN Trailer IN ('{','A','B','C','D','E','F','G','H','I')
THEN LEFT(ingredientcost,LEN(ingredientcost)-1)
+ CAST(CHARINDEX(Trailer,'{ABCDEFGHI')-1 AS VARCHAR(1))
WHEN Trailer IN ('J','K','L','M','N','O','P','Q','R','}')
THEN '-' + LEFT(ingredientcost,LEN(ingredientcost)-1) + '1'
END AS MONEY)/100
FROM ...
CROSS APPLY...
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]
August 12, 2013 at 1:20 pm
mayurkb (8/9/2013)
ScottPletcher (8/9/2013)
SQL will only be able to do a seek on that index if...
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]
August 9, 2013 at 11:34 am
Stefan_G (8/7/2013)
A little challenge:Assume there is a clustered index on the date column.
Can you create a query that exploits the clustered index to achieve even better performance?
Back to you, Stefan....
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]
August 7, 2013 at 1:33 pm
-- sample data
DROP TABLE #CSV_Details_MainFile
CREATE TABLE #CSV_Details_MainFile (GA_Drg_NO VARCHAR(25), Rev_NO CHAR(1), Mark_No VARCHAR(3), mark_rev_no VARCHAR(3), DeleteFlag CHAR(1))
INSERT INTO #CSV_Details_MainFile (GA_Drg_NO, Rev_NO, Mark_No, mark_rev_no, DeleteFlag) VALUES
('C63-GPE105-499-003','1','10','10','1'),
('C63-GPE105-499-003','1','10','10','1'),
('C63-GPE105-499-004','1','10','10',NULL),
('C63-GPE105-499-004','1','10','40','1'),
('C63-GPE105-499-004','2','10','10',NULL),
('C63-GPE105-499-004','2','10','10',NULL),
('C63-GPE105-499-005','1','10','10',NULL),
('C63-GPE105-499-005','1','10','10',NULL),
('C63-GPE105-499-005','1','10','20','1'),
('C63-GPE105-499-005','1','10','10','1')
CREATE CLUSTERED INDEX cx_LoadsOfStuff ON...
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]
August 6, 2013 at 1:33 pm
Peter Brinkhaus (8/6/2013)
azdeji (8/6/2013)
Both SQL codes work perfectly!Thanks Peter Brinkhaus and ChrisM@home
Strange, because my solution gives an entirely different result then the solution of Chris
Oh Peter, my humblest apology. I...
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]
August 6, 2013 at 1:09 pm
azdeji (8/6/2013)
...Up to 10000
Is possible create numbered sequences like the ROW_ID above, where the row numbers repeat themselves up to 10000 into an empty column?
In SQL server
Thanks
Yes it...
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]
August 6, 2013 at 11:59 am
Peter Brinkhaus (8/6/2013)
Something like this?...
Check out the last 20 rows of your result set, Peter.
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]
August 6, 2013 at 11:53 am
WITH Tens AS (SELECT * FROM (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) d (n)),
iTally AS (SELECT n = ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) FROM Tens a CROSS JOIN Tens b CROSS JOIN Tens...
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]
August 6, 2013 at 11:47 am
I reckon it's somewhere around your DOB, Lowell 😛
SELECT *
FROM (SELECT ticks = 624511296000000000) z
CROSS APPLY (SELECT microseconds = z.ticks/100) a
CROSS APPLY (SELECT milliseconds = a.microseconds/1000) b
CROSS APPLY (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]
July 30, 2013 at 1:31 pm
SQL_Surfer (7/28/2013)
Can you give me some pointers of rewriting this query? Can data be grabbed at 1 shot instead of doing UNION ALL.
I think so. Post the whole query 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]
July 28, 2013 at 1:46 pm
Viewing 15 posts - 316 through 330 (of 1,228 total)