Viewing 15 posts - 496 through 510 (of 1,229 total)
Without an ORDER BY, TOP is meaningless:
SELECT
t1.col1,
col2 = ISNULL(t1.col2, x.col2)
FROM @T t1
OUTER APPLY (
SELECT TOP 1
t2.col2
FROM @T t2
WHERE t2.col1 > t1.col1
AND t2.col2 IS NOT NULL...
July 22, 2012 at 3:28 am
XMLSQLNinja (7/18/2012)
...There are other ways to do this but using recursion is generally the fastest.
Recursion is the third fastest; CLR > "Quirky Update" > rCTE > cursor > triangular join....
July 20, 2012 at 3:29 am
darthurfle (7/19/2012)
Hi,Does anybody have a solution for this problem?
Many Thanks!
Without a sample data script to work with? Figure out the algorithm for generating the numbers in the seq column, filtering...
July 20, 2012 at 12:57 am
Have a look at Peter Larsson's Composable DML blog entry.
July 17, 2012 at 10:50 am
anthony.green (7/10/2012)
I had a couple of pints of St Austell's Tribute on Saturday, that was a good tasting ale
This weekend is the Tewkesbury Medieval Festival[/url] where our band of brothers...
July 13, 2012 at 5:59 am
JayWinter (7/12/2012)
July 13, 2012 at 1:00 am
JayWinter (7/12/2012)
I.SKU will be used to retrieve a record from from ITEMMAST when either J.SKU=I.SKU or J.ITEMUPC=I.SKU
FROM
Evy_RH_Objects.dbo.RETAIL_SALES I
INNER JOIN RH2007_EvyLive.dbo.ITEMMAST J on...
July 13, 2012 at 12:58 am
Evil Kraig F (7/12/2012)
July 13, 2012 at 12:29 am
Next, put repeated correlated subqueries into the FROM list as OUTER APPLY. What's left is fairly straightforward except for the remaining correlated subqueries in the output;
DECLARE @strBE NVARCHAR(4)
SET @strBE ='1000'
...
July 8, 2012 at 5:36 am
Jeff's nailed all the reasons for rewriting this query from scratch, and I agree, chuck it away and start again. However, sometimes you can gain from having a baseline in...
July 8, 2012 at 5:12 am
debris_flow (7/6/2012)
discovered by each QA analysts in the team for one year. Please describe a
simple SQL statement for identifying...
July 7, 2012 at 1:36 am
Shcherbunov Neil (7/6/2012)
1. SQL Server won't sub in an indexed view if the query is trivial - and it is.
My guess - this statement bears the stamp of truth. If...
July 6, 2012 at 11:39 am
coronaride (7/3/2012)
I think I may see what you're getting at. Are you saying that when...
July 3, 2012 at 11:17 am
coronaride (7/3/2012)
July 3, 2012 at 11:11 am
coronaride (7/3/2012)
July 3, 2012 at 11:07 am
Viewing 15 posts - 496 through 510 (of 1,229 total)