Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Time out Expired


Time out Expired

Author
Message
vs.satheesh
vs.satheesh
SSC Journeyman
SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)SSC Journeyman (97 reputation)

Group: General Forum Members
Points: 97 Visits: 630
i am using CTE in following ways


with CTE1
(
select * from xx
),
CTE2
(
select * from test inner join CTE1 CT on test.id=CT.id
) ,

CTE3
(
select * from yyyy
)


select * from CTE1
inner join CTE2 on CTE1.od=CTE2.id
inner join CTE3 on CTE3.id=CTE1.id



My question is

I am give select * means its retrieving with in two seconds.But I am specify column name means Its taking 5 min .I am really surprised. Please give me a solution.
Lowell
Lowell
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14965 Visits: 38984
vs.satheesh (6/7/2013)
i am using CTE in following ways


with CTE1
(
select * from xx
),
CTE2
(
select * from xx a inner join CTE1 CT on xx.id=CT.id
) ,

CTE3
(
select * from yyyy
)


select * from CTE1
inner join CTE2 on CTE1.od=CTE2.id
inner join CTE3 on CTE3.id=CTE1.id



My question is

I am give select * means its retrieving with in two seconds.But I am specify column name means Its taking 5 min .I am really surprised. Please give me a solution.



well, it looks to me like your pseudo code doesn't show us enough;
CTE2 would fail because the column names are not unique, since you are selecting from the same table [xx] twice

can you show us either the real sql you are using, or a find-and-replace obfuscation, instead?

Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Alexander Suprun
Alexander Suprun
Old Hand
Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)Old Hand (341 reputation)

Group: General Forum Members
Points: 341 Visits: 1516
vs.satheesh (6/7/2013)
My question is

I am give select * means its retrieving with in two seconds.But I am specify column name means Its taking 5 min .I am really surprised. Please give me a solution.
Have you looked at execution plans already?


Alex Suprun
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search