Viewing 15 posts - 5,356 through 5,370 (of 10,144 total)
Shalinder, you could use a cross-apply cascade, something like this:
SELECT d.TheString,
Col1 = SUBSTRING(TheString,1,p1-1),
Col2 = SUBSTRING(TheString,p1+1,p2-p1-1),
Col3 = SUBSTRING(TheString,p2+1,p3-p2-1),
Col4 = SUBSTRING(TheString,p3+1,p4-p3-1)
FROM (SELECT TheString = 'abcd9efghij9kl9mno', TheDelimiter = '9') d
CROSS APPLY (SELECT...
December 6, 2012 at 6:58 am
-- run this and check DateFinished in the output to see how many
-- rows you should expect to return for December 2012, the current month.
-- The oldest rows...
December 5, 2012 at 7:36 am
cooljagadeesh (12/4/2012)
Hi All,Can any one explain Wat is the main difference between cross apply and inner join???
according to my view
both are functionality wise same syntax wise different
They can...
December 5, 2012 at 6:56 am
Can you post your original query, George? The last two weeks' version? Cheers.
December 5, 2012 at 6:36 am
Use a cross-tab query to pivot the results, it's generally faster than PIVOT and more intuitive too:
SELECT
Col1 = MAX(CASE WHEN ItemNumber = 1 THEN Item END),
Col2 = MAX(CASE WHEN...
December 5, 2012 at 6:35 am
Randy Doub (11/29/2012)
November 29, 2012 at 8:53 am
j_wentu (11/29/2012)
So what's the teaching here (for the community)? Better not to chain too many select in a CTE when there are groupings at "different level"?
This gets my vote, by...
November 29, 2012 at 8:26 am
The optimizer struggles with chained CTE's where elements in the chain are at different levels of aggregation, which is exactly what you have here. Try running the results into a...
November 29, 2012 at 7:01 am
-- sample data
;WITH SampleData (StockCode, supplydate, AvailableQty) AS (
SELECT 'a', '01/12/12', 10 UNION ALL
SELECT 'a', '08/12/12', 2 UNION ALL
SELECT 'a', '28/12/12', 6 UNION ALL
SELECT 'a', '5/01/13', 15 UNION ALL
SELECT 'a',...
November 29, 2012 at 6:23 am
Create a unique clustered index on column [row].
November 28, 2012 at 6:58 am
Jeff Moden (11/19/2012)
ChrisM@home (10/15/2012)
Jan Van der Eecken (10/15/2012)
Nice one, Tom! But does the TRY_CONVERT() make the query non-sargeable? Guess it would?
Good point, Jan. I remember recently Howard W posted evidence...
November 23, 2012 at 6:44 am
Sony Francis @EY (11/7/2012)
SELECT *
FROM TableA a
LEFT OUTER JOIN TableB b ON a.LoanID = b.LoanID
WHERE b.ColumnA <> 'Y'
When we use INNER JOIN it will consider only commom records....
November 7, 2012 at 7:00 am
-- Have a look at the dupesets in the source table - do you want them, or not?
-- Then decide what to do. No point in finding a clever way...
November 7, 2012 at 6:55 am
Resender (11/7/2012)
It's a habit of mine to use where 1 =1 cause then when i need to add/remove filters I don't have to remove the where only 'and'
+1
November 7, 2012 at 6:35 am
yuvipoy (11/5/2012)
this is mytablestartid, endid
1,1
2,1
3,1
4,2
6,3
Is this structure the same or different for each string of numbers you have to process?
November 6, 2012 at 6:42 am
Viewing 15 posts - 5,356 through 5,370 (of 10,144 total)