Querying Active Directory

  • Hi All,

    Need help with regards to querying AD, i have created a linked server to AD but the AD name e.g ad-domain. So in my query i've used [ ] brackets but still it errors

    Msg 102, Level 15, State 1, Line 19

    Incorrect syntax near '-'.

    Any idea

    Thanks

    It's better to fail while trying, rather than fail without trying!!!

  • Not without seeing the full query, but sounds like you have a syntax error near - on line 19

  • Apologies missed the script attachment

    It's better to fail while trying, rather than fail without trying!!!

  • Looks ok to me, not a case of missing [] around msRTCSIP-PrimaryUserAddress in the OPENQUERY is it?

  • That's a good catch, Anthony. In case it isn't that, I'd be tempted to write it out longhand, 26 times, just to avoid all those confounded quotation marks. You can save the data arithmetic to the end to make it more efficient and the code more concise.

    John

  • Thanks sorted

    It's better to fail while trying, rather than fail without trying!!!

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply