CREATE Function GetBFBin
(@tempRYDM VarChar(8),@tempType TinyInt)
Returns Char(510)
As
Begin
Declare @tempBin VarBinary(255),@tempStr VarChar(510)
Select @tempBin=(Case @tempType
When 0 Then LOGIN_PASSWORD
When 1 Then CZQX1
When 2 Then CZQX2
When 3 Then CZQX3
When 4 Then CZQX4
When 5 Then CZQX5
When 6 Then CZQX6
End)
From dbo.XTCZY Where PERSON_ID=(Select PERSON_ID
From dbo.RYXX Where RYDM=@tempRYDM)
Exec Master..XP_VarBinToHexStr @tempBin, @tempStr Out
Select @tempStr=Right(@tempStr,Len(@tempStr)-2)
Return @tempStr
End