Home Forums SQL Server 7,2000 T-SQL Query to compare user in application and AD RE: Query to compare user in application and AD

  • is the CAC card number in table anyplace, or can it be used to get CACNumber +email, so it can be joined to your ADObj table?

    your snippet was incomplete/not syntactically correct, but you might be able to use a case statement to join the data?

    SELECT * FROM T1

    INNER JOIN SomeTableWithCAC C1 ON T1.Something = C1.Something --CAC# to login reference?

    left outer join dbo.ADObj T2

    on CASE

    WHEN IsNumeric(substring(T1.login_name,1,charindex('@',T1.login_name+'@')-1)) = 1

    THEN C1.LoginName

    ELSE substring(T1.login_name,1,charindex('@',T1.login_name+'@')-1)

    END = T2.ADAccountName

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!