用SQL中的isnull函数注意了
declare @temPassword varchar(50)
select @temPassword=isnull([Password],'') from A where LoginName=@LoginName
select @temPassword
假设@LoginName参数为123
当表A中存在一表数据的LoginName为123,且[Password]字段确实为NULL,这时 select @temPassword 的@temPassword值为isnull之后的''值.
如果表A中不存在数据为123时,这时 select @temPassword 的@temPassword值为isnull之后还是null,即isnull未起作用.