June 4, 2014 at 12:41 pm
dquirion78 (6/4/2014)
Who cares what language the columns names are in? We can't offer much help because we can't see your screen, have no idea what your data structures are like, no idea what your query is trying to do. In short, we can't help much because you haven't given us the whole question. Maybe you need to defined both ctes at the same time?
with cte1 as (select whatever here),
cte2 as (select somestuff join to cte1 etc...),
cte3 as (select cte1 union cte2)
If you really want help with this process (which I am guessing that performance is part of issue here) you are going to have to provide us some details.
Basically what I'm doing right now but it takes too much time. Cte1 is pretty long and complex, cte2 is simple but use cte1...
Cte1 takes 2.5 seconds
cte2 takes 2.6 seconds because of cte1
cte3 takes around (2.5+2.6)
so If I put cte1 inside a temp table and cte2 use the temp table then it will be way faster because ( I guess).
So it does all come down to a performance issue. You realize that without table and index definitions, the actual query and an actual execution plan that anything somebody suggests is just a shot in the dark with little to no hope of actually helping?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
June 4, 2014 at 12:42 pm
Here is the problem, we can't see what you see unless you show us. Without knowing what it is you are trying to accomplish about all we can do is take shots in the dark and hope we hit the target.
June 4, 2014 at 1:43 pm
Also I find if I start a simple code to test what I am doing I will find the problem in the big picture. I will take my code and strip to one table then add the next and so on.
Just my two cents.
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply