0

i have a proc that loads a users table and in doing so makes an association between users and their managers. i have the simple select below to figure out maangerId for each user record. i see there is a manager that should be assigned to a user but the user gets a blank and the assignment of managerId is missing.

DECLARE @managerId INT     
SET @managerId = NULL    

IF @CorpManagerDN IS NOT NULL    
BEGIN    

 IF EXISTS (SELECT 69 FROM Employees WITH(NOLOCK) WHERE CorpManagerDN = @CorpManagerDN)    
 BEGIN    
  SELECT @managerId = EmployeeId FROM Employees WHERE CorpDN = @CorpManagerDN   
 END    
END 

the userId is a self incrmenting field so that works out well, and the managerId field is populated with the logic above. i notice sometimes i get blank managerId values when i see CorpManagerDN values like

CN=Tsahalis\, Peter NBKPVUD,OU=Pre-BAND,OU=Accounts,OU=BAND,DC=corp,DC=bankofamerica,DC=com

and i see CORPDN value of the manager like

CN=Tsahalis\, Peter NBKPVUD,OU=Pre-BAND,OU=Accounts,OU=BAND,DC=corp,DC=bankofamerica,DC=com

but the sql evaluation doesn't match them?

1
  • whats your sql server collation Commented Dec 11, 2010 at 13:01

1 Answer 1

1

They seem equal to me

select 
case when   
    'CN=Tsahalis\, Peter NBKPVUD,OU=Pre-BAND,OU=Accounts,OU=BAND,DC=corp,DC=bankofamerica,DC=com' 
      = 'CN=Tsahalis\, Peter NBKPVUD,OU=Pre-BAND,OU=Accounts,OU=BAND,DC=corp,DC=bankofamerica,DC=com'
     THEN 1
     else 0
END
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.