Viewing 15 posts - 1,171 through 1,185 (of 3,543 total)
My solution for what it's worth 😉
SELECTIDENTITY(INT,1,1) AS [RowNum],
PartNumber,
Factor
INTO#MyHead
FROMdbo.XlsDump
ORDER BY PartNumber, Factor
SELECT IDENTITY(INT,0,1) AS [GroupNumber],0 AS [RowNum]
INTO #MyHead2
INSERT #MyHead2 (RowNum)
SELECT a.RowNum
FROM #MyHead a
LEFT JOIN #MyHead n ON n.RowNum=a.RowNum+1
WHERE NOT (a.Factor=n.Factor)
OR...
March 9, 2011 at 7:49 am
SQLkiwi (3/7/2011)
Gianluca Sartori (3/7/2011)
SQLkiwi (3/4/2011)
Exciting day - just had my first Simple Talk article published:http://www.simple-talk.com/sql/learn-sql-server/understanding-and-using-parallelism-in-sql-server/
Great job, Paul! Outstanding, as usual.
Now there's a chance that a poor n00b like me can...
March 7, 2011 at 9:06 am
Ian Scarlett (2/24/2011)
SQLkiwi (2/24/2011)
David Benoit (2/24/2011)
I remember when I took my first programming class, Pascal (Turbo actually)...I did a term using Turbo Pascal at University too.
OMG, that makes me feel...
February 24, 2011 at 9:06 am
GSquared (2/18/2011)
David Burrows (2/18/2011)
string strsql = "";strsql += " Select '' AS [CustomerId],' ---Select Customer --- ' AS [CompanyName] ";
strsql += " Union Select CustomerId, CompanyName ";
strsql +=...
February 18, 2011 at 7:39 am
Gianluca Sartori (2/18/2011)
If I didn't post on THE THREAD a "Lennie alert" nobody would have noticed, Lennie would have got his answer and...
February 18, 2011 at 7:14 am
string strsql = "";
strsql += " Select '' AS [CustomerId],' ---Select Customer --- ' AS [CompanyName] ";
strsql += " Union Select CustomerId, CompanyName ";
strsql += " From testCustomers...
February 18, 2011 at 4:48 am
Or even this
SELECT RegionName,
AVG(CASE WHEN Month_Value = 7 THEN Answer END) AS [PreviousMonthAns],
AVG(CASE WHEN Month_Value = 8 THEN Answer END) AS [Answer]
FROM Mst_Location A
JOIN Voc_Trans_Details D...
January 31, 2011 at 7:20 am
This probably better than the join
SELECT RegionName,
CASE WHEN Month_Value = 7 THEN Answer END AS [PreviousMonthAns],
CASE WHEN Month_Value = 8 THEN Answer END AS [Answer]
FROM x
GROUP...
January 31, 2011 at 7:16 am
WITH x (RegionName, Month_Value, Answer) AS (
SELECT B.RegionName, D.Month_Value, AVG(D.Answer) AS [Answer]
FROM Mst_Location A
JOIN Voc_Trans_Details D ON A.LocationID = D.Location_Id
JOIN Master_Map_RegionWithLocation C ON A.LocationID = C.LocationID
JOIN...
January 31, 2011 at 7:01 am
My query had a problem and for the record I post a revised version
Based on a million rows of my test data
'1,2,3,"abc,def",4,5,"ghi,jkl",6,7,"8,"""",x,y"""",",9'
on my desktop, it took 7 iterations taking...
January 25, 2011 at 5:21 am
This solution uses a temp table to add a unique id to the data
It needs to be repeated until no updates are left
(sorry about the short names but it was...
January 24, 2011 at 2:14 pm
Craig Farrell (1/24/2011)
PatIndex('%"%,%"%',THE_LINE)),
-- with this:
PatIndex('%,"%,%",%',THE_LINE)),
Note where the additional commas are to detect beginning and ending doublequotes.
I may have an alternative for you but it's going to be a busy...
January 24, 2011 at 11:53 am
David Burrows (1/24/2011)
The main problem as I see it is the possiblity of commas between the quotes in a text column.
This will replace commas between quotes with the pipe character
STUFF([column],CHARINDEX(',',[column],PATINDEX('%"%,%"%',[column])),1,'|')...
January 24, 2011 at 7:19 am
Viewing 15 posts - 1,171 through 1,185 (of 3,543 total)