Click to See Complete Forum and Search --> : Stored Proc [Invalid object name]


ShaReB
02-08-2008, 10:51 AM
I'm getting this error
Msg 208, Level 16, State 1, Procedure updateDiagnosis, Line 5
Invalid object name 'diagnose'
for this procedure
alter proc updateDiagnosis @column varchar(50), @tooth_no int, @patient_id int, @confirm bit output
as
begin
if exists(select * from diagnose inner join visit on diagnose.visit_id = visit.visit_id where diagnose.tooth_no =@tooth_no and visit.patient_id =@patient_Id)
begin
update diagnose set @column = 1 from diagnose
inner join visit on diagnose.visit_id = visit.visit_id
where diagnose.tooth_no =@tooth_no
and visit.patient_id =@patient_Id
set @confirm = 'true'
end
else set @confirm = 'false'
return @confirm
end
any help?

chazzy
02-08-2008, 07:01 PM
Just a shot in the dark: does the table diagnose exist in the same schema as this proc?

ShaReB
02-11-2008, 05:11 PM
Just a shot in the dark: does the table diagnose exist in the same schema as this proc?
Yea, its the schema, thank you

chazzy
02-11-2008, 07:10 PM
ok... well what are permissions like? what happens if you put on the full prefix for the table when referencing it?

ShaReB
02-12-2008, 09:52 AM
ok... well what are permissions like? what happens if you put on the full prefix for the table when referencing it?
Thanks again, i discovered that the procedure isn't in the same schema as you said earlier and it's working fine right now
I'll use full table prefix next time.

greetings from Egypt!!