Viewing 15 posts - 3,631 through 3,645 (of 10,143 total)
Hi and welcome to ssc.
There's an article for newcomers which you may find useful; http://www.sqlservercentral.com/articles/Best+Practices/61537/%5B/url%5D
If you take a little time to prepare a sample data script, forum users will...
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
February 19, 2014 at 2:54 am
This will do it, but it's somewhat arbitrary:
ORDER BY b.displayorder, ISNULL(c.col1,2147483647) DESC
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
February 18, 2014 at 6:21 am
Why?
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
February 18, 2014 at 6:13 am
A simple query exactly described generates this dataset:
Col1col2col3#IDCol1col2displayorder#Col1col2col3
5C053#3131#515
6C061#1112#NULLNULLNULL
1C011#1112#111
3C031#1112#313
4C042#2123#414
2C022#2123#212
Here's a sample data script and a query constructed from your notes:
DROP TABLE #TableA
CREATE TABLE #TableA (Col1 INT, col2 VARCHAR(3), col3 INT)
INSERT INTO...
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
February 18, 2014 at 4:57 am
Greg Edwards-268690 (2/17/2014)
Ed Wagner (2/17/2014)
dwain.c (2/16/2014)
Ed Wagner (2/13/2014)
dwain.c (2/13/2014)
Jack Corbett (2/13/2014)
Glad no bare-chested pictures of Grant, or frankly anyone on the thread, have popped up here too.
I guess...
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
February 17, 2014 at 6:39 am
phineas629 (2/12/2014)
I feel like I've been stuck in sql purgatory, just barely knowing enough to get by. I'm really hoping to make the leap to a real developer. I...
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
February 13, 2014 at 2:34 am
abhas (2/11/2014)
I want to convert time into hours as per below format. Please guide.
For example – 2:15:00 would be computed as 2.25 HRS or 6:30:00 would show 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
February 12, 2014 at 3:38 am
chetan.deshpande001 (2/10/2014)
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
February 12, 2014 at 3:23 am
Nice work. I'd miss out the first view though - unless it's going to be used elsewhere, it's simply clutter:
SELECT RowID,
MAX(CASE WHEN LineNumber = 1 THEN DelAddr ELSE ''...
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
February 12, 2014 at 3:19 am
hoseam (2/10/2014)
The end to end process is pretty much what I have said, I have products I need to clone. I have 10 tables, in any table I might need...
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
February 12, 2014 at 2:58 am
ss.meghana8 (2/10/2014)
I have 2 columns colour,countof
How many colours?
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
February 10, 2014 at 8:50 am
;WITH MyData AS (
SELECT SUBTerms = 2, initialstartdate = CAST('2013-03-15' AS DATE) UNION ALL SELECT 4, '2013-01-15' UNION ALL SELECT 6, '2013-05-15'
)
-- MyData is a mockup of your existing result...
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
February 10, 2014 at 7:12 am
kapil_kk (2/10/2014)
ChrisM@Work (2/10/2014)
balu.arunkumar (2/10/2014)
/*------------------------
SELECT*, SUM( Price ) OVER( Partition BY Customer_Name ORDER BY DatePurchased) AS Total_Till_Date
FROM#sample where Customer_Name='A'
------------------------*/
Msg 102, Level 15, State 1, Line 1
Incorrect syntax...
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
February 10, 2014 at 6:49 am
The return value of a stored procedure is int, and cannot be changed. Traditionally it was used to indicate success (RETURN 0) or failure (RETURN n, usually negative).
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
February 10, 2014 at 6:47 am
Do you have a fixed number of colours? If so, can you list them please?
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
February 10, 2014 at 6:44 am
Viewing 15 posts - 3,631 through 3,645 (of 10,143 total)