SQL Server - Combine 2 select query results in stored procedure

Asked By Divya Ajesh
04-Feb-12 02:13 AM
 Hi,
 I have 2 Select query in stored a stored procedure. i want to combine 2 select query results because i want  to display the
combined result in a grid view.
My Stored procedure is given below

ALTER PROCEDURE [dbo].[Sp_Exam_Student_List]
    @Sp_classcreationid int,
    @Sp_Sectionid int,
    @Sp_Exam_id int
    
    --@Sp_Class nvarchar(50),
    --@Sp_Section nvarchar(50)
    
AS
BEGIN

SELECT StudentPersonalInformation.studentregno ,StudentPersonalInformation.candidatename,
StudentPresentEducationInformation.class,StudentPresentEducationInformation.section,
StudentPresentEducationInformation.rollno
from StudentPersonalInformation full join
StudentPresentEducationInformation on
StudentPersonalInformation.studentregno = StudentPresentEducationInformation.studentregno  
where classcreationid=@Sp_classcreationid and classsectioncreationid = @Sp_Sectionid and
StudentPersonalInformation.studentregno = StudentPresentEducationInformation.studentregno
order by StudentPresentEducationInformation.rollno ASC
---------------------------------------------------------------------------------
Above one is the First select query
---------------------------------------------------------------------------------
Select exam_id,CEI.min_mark,CEI.max_mark  from  ClassExam_Information CEI where CEI.exam_id = @Sp_Exam_id

END
 
  dipa ahuja replied to Divya Ajesh
04-Feb-12 03:04 AM
To combine two table result you have to write join query

select e.empid,e.sal,
e.Address,
ed.ename from edetail e inner join emp ed on e.empid=ed.empid;

  Divya Ajesh replied to dipa ahuja
04-Feb-12 03:42 AM
But I'm using full join in first select query.
Create New Account
help
How can I decrypt a SQL Server stored-procedure? SQL Server hi Please help on this How can I decrypt a SQL Server stored-procedure? thx guru SQL Server Programming Discussions SQL Server (1) Stored procedure (1) Stu (1
Additonal thoughts, you should be able to connect to SQL Server via SQL Server SQL Server Additonal thoughts, you should be able to connect to SQL Server via SQL Server Management Studio. This will provide you with whether or not SQL Server
Can't login to SQL Server SQL Server Hello, I'm trying to migrate one SQL Server 2000 database to SQL Server Express, and I'm having the following issue. In the SQL Server 2000 database I
Alias for Linked SQL Server? SQL Server Hi, I'm trying to connect to a linked SQL Server 2008 from my local SQL = Server 2008. Everything seems to work fine so far but I'm having the following = problem
Accessing data on a server? SQL Server I have SQL Server developer edition installed on one computer and SQL Server Express Edition install on another computer. When I try to "Attach" a database located on my file server, SQL Server does not "see" the network drive. Is there anyway to get a local