Viewing 15 posts - 2,671 through 2,685 (of 5,504 total)
How about
SELECT your_statement1
UNION ALL
SELECT your_statement2
?
Side note: you don't really need to store it in two temp tables before the UNION operation (as long as you don't need those separate...
October 22, 2010 at 2:36 pm
ALZDBA (10/22/2010)
Jeff Moden (10/21/2010)
ALZDBA (10/20/2010)
Dito.And it only serves a single purpose. i.e. strict hierarchy.
Ever tried building a family tree ?
Thanks for the input, Johan. Heh... from what I've seen,...
October 22, 2010 at 9:03 am
gmrose (10/21/2010)
October 22, 2010 at 8:45 am
That explains the bad performance pretty much...
You're using a table variable just like I did for my demo version. :blush: My fault. I'm sorry.
A table variable is a bad option...
October 21, 2010 at 12:56 pm
gmrose (10/20/2010)
October 21, 2010 at 8:55 am
Craig Farrell (10/20/2010)
Lutz, that is wild. I like it. Thanks. :w00t:Have you done that on huge recordsets? Does it perform well?
No, I haven't. And I probably won't either.
Such...
October 20, 2010 at 6:12 pm
You might want to compare the performance of your loop with the following code.
I can't tell you if it'll return the same results since I have nothing to test against,...
October 20, 2010 at 5:00 pm
It's slightly more complicated than just using a CTE...
DECLARE @tbl TABLE
(
ckid INT,stat VARCHAR(10)
)
INSERT INTO @tbl
SELECT 101 ,'Open' UNION ALL
SELECT 102 ,'Open' UNION ALL
SELECT 103 ,'Open' UNION...
October 20, 2010 at 4:42 pm
Something along those lines?
SELECT
id,
CASE
WHEN EXISTS (SELECT 1 FROM #TblTemp t2 WHERE t1.id=t2.id AND Price=9999.9999)
THEN 1111.1111
ELSE AVG(Price) END AVGPrice
FROM #TblTemp t1
GROUP BY Id
October 20, 2010 at 3:06 pm
Did you search this site for "DelimitedString8K" on this site?
This is a function posted by Jeff Moden. If you get the "right thread" (don't recall the link right now) you'll...
October 20, 2010 at 2:56 pm
GilaMonster (10/20/2010)
For the second one, check out the thread over at SQLTeam with the same question.
I followed the link you posted and it seems like the OP is not erally...
October 20, 2010 at 2:50 pm
Is it just because I'm in a bad mood today or why do I have the feeling that todays questions are more demanding with even less effort than on other...
October 20, 2010 at 2:17 pm
Uripedes Pants (10/20/2010)
October 20, 2010 at 2:05 pm
SeanLange (10/20/2010)
LOL Lutz. 😀
What's so funny about it? I found it rather sad... :crying:
October 20, 2010 at 1:58 pm
Viewing 15 posts - 2,671 through 2,685 (of 5,504 total)