declare @StdID varchar(50)
Set @StdID= 'R-000003'
select * into #TempMarks 
from ( select * 
		from ( select [SubjectID],[SetExamID],[Marks] 
		from tblSetMarks where AdmissionNo= @StdID as tbl
		pivot (sum(Marks) for [SetExamID] in ([14],[15])) as PVT
) as s
select *,[14]+[15] as 'Grand Total' from #TempMarks
union all
select 'Total', sum([14]), sum ([15]), sum ([14]+[15]) from #TempMarks
drop table #TempMarks
This query is showing error Incorrect syntax near the keyword 'as'. and my table is 
| SetExamID | ClassID | SectionID | SubjectID | AdmissionNo | Marks | Total Marks | 
| 14 | 1 | 50 | 10 | R-0001 | 20 | 25 | 
| 14 | 1 | 50 | 11 | R-0002 | 15 | 25 | 
| 14 | 1 | 50 | 12 | R-0003 | 21 | 25 | 
| 15 | 1 | 50 | 10 | R-0001 | 35 | 50 | 
| 15 | 1 | 50 | 11 | R-0002 | 24 | 50 | 
| 15 | 1 | 50 | 12 | R-0003 | 29 | 50 |