Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-07-30 : 09:38:14
|
Keith writes "Is it possible to query active directory using a SQL Linked Server? We're looking to validate users' email addresses that exist Exchange Server from within a stored procedure." |
|
jasper_smith
SQL Server MVP & SQLTeam MVY
846 Posts |
Posted - 2002-07-30 : 12:00:00
|
Check out linked server in BOLHere's an example :sp_addlinkedserver 'ADSI','Active Directory Services2.5','ADSDSOObject','adsdatasource'goIf exists (select 1 from openquery(ADSI, 'select mail from ''LDAP://EXSERVER'' WHERE mail=''JSmith@nospam.co.uk'''))print 'email valid'elseprint 'email not found'In this case I am querying one of our Exchange servers (that's not its real name ) via LDAP to match the email address. Similar principal applies to AD - jsut got to learn the odd syntaxHTHJasper Smith |
|
|
|
|
|