sql server - SQL query taking a long time to execute -


use pooja go ----create testtable create table testtable(rtjobcode varchar(20), rtprofcode smallint,rttestcode smallint,profcode smallint,testcode smallint) ----insert testtable using select insert testtable (rtjobcode, rtprofcode,rttestcode,profcode,testcode) select rtjobcode,rttestcode,testcode,rtprofcode,profcode dbo.resulttest,dbo.test,dbo.profiles rttestcode=any(select testcode dbo.test)  ----verify data in testtable select * testtable  go 

the above code tries take out entries table called resutltest , profiles , test,

the problem during creation of cube encountering data not consistent in tables, tried join on tables tables contained huge number of columns was'nt feasible tried making code keeps on executing without stopping , not displaying data

resulttest's rttestcode foreign key testcode

your query slow because making cartesian product between resulttest, test , profiles. need provide "join" conditions link tables together.

select rtjobcode      , rttestcode      , testcode      , rtprofcode       , profcode dbo.resulttest r  join dbo.test t   on r.rttestcode = t.testcode join dbo.profiles p   on r.rtprofcode = p.profcode  

i speculate query looking for. note conditions link resulttest , test , condition links resulttest , profiles together.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -