Hi,
Check this....
SELECT COURSENAME + '[' + CONVERT(VARCHAR,SEMNUMBER) + ']'
FROM COURSE, SEMESTER
WHERE
COURSEID=@CidFromDDL
AND SEMID=@SemIdFromDDL
Quote:
producing m * n rows, and then select the one that happens to join the selected course to the selected semester
or in Other way round in order to minimize cross join impact.....
Create proc pr_result
(
@pa_courseId int,
@pa_semId int
)
As
begin
create table #tmp_course
(
cid int,
cname varchar(200)
)
insert into #tmp_course(cid,cname )
select courseid,coursename from course where courseid=@pa_courseId
create table #tmp_semester
(
sid int,
sno int
)
insert into #tmp_semester(sid ,sno )
select courseid,coursename from course where courseid=@pa_semId
SELECT cname+ '[' + CONVERT(VARCHAR,sno ) + ']'
FROM #tmp_course, #tmp_semester
end
Hope this will help you.
Cheers