sql server - In SQL replace null value with another value -


here sql query

select p.studentid, ai.rollno, p.firstname, p.middlename, p.lastname,  om.examid,  et.examname, om.subjectid, isnull(convert(varchar(20),om.obtainedmarkstheory), 'a') 'obtainedmarkstheory',  isnull(convert(varchar(20),om.obtainedpracticalmarks),'a') 'obtainedpracticalmarks' students.personalinfo p inner join students.academiccourse ac on p.studentid = ac.studentid inner join students.academicinfo ai on p.studentid=ai.studentid left outer join exam.obtainedmarkentry om on p.studentid = om.studentid left join exam.examtype et   on om.examid = et.examid ai.batchid = '103' , ai.semesterid = '21' , ac.section = '8' 

this produce result in picture:

but want result since 2 students absent in exam

similarly if exam exists of 3 student , other absent same procedure should repeat

use isnull() function see below example

declare @variable varchar(max) set @variable = null select isnull(@variable,0) 

enter image description here


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -