writing sql procedure I wrote a sql procedure to get the name of the physician by entering the Eid in sql server.

create procedure doca(@eid int,@pname varchar  output)
as
begin
select @pname =p.name
from physician p
where p.eid =@eid
end


I used the procedure by following way

declare @pname varchar
exec doca 1,@pname output
print @pname


when I enter 1 I want to get the name of the physician whose eid is 1.

in this case it should be "John Dorian"
but this procedure prints just "J"

whats wrong with my code?
Declare the @pname as varchar(x)  where x is the length of the Physician.Name column.  Make the change in both pieces of code.

Declaring the variable as just varchar indicates you only want a single character at most.