try
alter procedure spLoginn(
@Email varchar(50),
@Pasword varchar(20),
@RId int out
)
as BEGIN
if ( @Email is not null and @Pasword is not null )
begin
set @Rid=(Select RoleId from tblTeacher where Email=@Email and Pasword=@Pasword)
if @Rid is null
set @Rid=(Select RoleId from tblStudent where Email=@Email and Pasword=@Pasword)
end
END
if
@RId
is
null
then the Email/Password combination is not present either table.