Hello Jorge,
Here's how to set up a linked server to exchange:
exec sp_dropserver 'ADSI'
go
exec sp_addlinkedserver 'ADSI', 'Active Directory Services 2.5', 'ADsDSOObject', 'adsdatasource' go
And here's an example of a view:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[viewADUsers]') and OBJECTPROPERTY(id, N'IsView') = 1) drop VIEW viewADUsers go
CREATE VIEW viewADUsers AS
SELECT * FROM OpenQuery( ADSI,'<LDAP://OU=yourOU,DC=yourDC,DC=com>;(&(objectCategory=Person)(objectClass=user));
name,sAMAccountName,givenname,initials,sn,physicalDeliveryOfficeName,primarygroupid,
mail,TelephoneNumber,pager,mobile,ipPhone,info,facsimileTelephoneNumber,streetaddress,st,postalcode,c,l,
title,department,company,manager')
Go
Thanks to Peter Macdonald from this forum.
Carol.
-----Original Message-----
From: Jorge Alberto Vazquez Mar [mailto:mssqldba-ezmlmshield-x10177857.[Email address protected]
Sent: 27 February 2007 15:03
To: LazyDBA Discussion
Subject: Sql & Exchange
I need to extract some information from our Exchange Server into a SQL database, does any one knows how I can connect it
Exchange 2000
Sql 2000 sp2
Regards
Jorge A.Vázquez
Sistemas Divisional
Tel. Mex +52-(656)-629-3170 Ext. 1834
Int.. 643-1834
Tel. USA (915)-298-2800 Ext. 1834
********************************************************************************
This communication may contain information that is proprietary, privileged, confidential or legally exempt from disclosure. If you are not a named addressee, you are notified that you are not authorized to read, print, retain, copy or disseminate this communication without the consent of the sender and that doing so may be unlawful. If you have received this communication in error, please notify the sender via return e-mail and delete it from your computer. Thank you.
********************************************************************************
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a dba job: http://jobs.lazydba.com To subscribe : http://www.LazyDBA.com To unsubscribe: http://www.lazydba.com/unsubscribe.html
This email and any files transmitted within it are private and confidential.
If you are not the intended recipient, this email and any attachments within it have been transmitted to you in error.
You are prohibited from using, copying, distributing or otherwise using the information contained within this email.
Nothing in this email message amounts to a contractual or legal commitment on the part of Optilan unless confirmed by a communication signed on behalf of the company.
Any email cannot be guaranteed to be secure, error free or free from viruses. Although every possible care is taken by Optilan, Optilan does not accept any liability whatsoever for any loss or damage which may be caused as a result of the transmission of this message by email.
MS Sql Server LazyDBA home page