- Create SQL Account
- Add CRMReaderRole role to the account where the organization database to access
- Get the GUID for the Dynamics CRM user you would like to impersonate.
- Use the Transact-SQL SET CONTEXT_INFO to set the context information to this GUID before querying the filtered view.
DECLARE @uid uniqueidentifier
SET @uid = convert(uniqueidentifier, 'user_guid')
SET CONTEXT_INFO @uid
SELECT * FROM [FilteredLead] - The query will return the records as if you were connected using the given user's Windows account. It should be noted that the SET CONTEXT_INFO is only required when establishing the connection, and once set will remain so for the duration of the session
Source: crmland