set @pid=(select name from login where name=@name);
Is '
name' of
int
type? I doubt that as in your
where
clause you compare
name with
@name (that is
varchar
)
So, either ways, if
name is
int
type then your
where
clause would throw an error OR if
name is
varchar
type then your set would throw an error.
Correct the datatype comparison/assignment.