Показать сообщение отдельно
Старый 17.08.2017, 18:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
Afna CRM: Executing SQL queries in CRM database on behalf of another user
Источник: http://a-crm.blogspot.com/2017/08/ex...-database.html
==============

If you are using filtered views in SSMS it is not possible to see what data will be returned for other users. But there is a way!

The GUID of the user is stored in the SQL CONTEXT_INFO. All you have to do is to run this piece of code:

DECLARE @binUserGuid VARBINARY(128)
DECLARE @userGuid UNIQUEIDENTIFIER
SET @userGuid =''
SET @binUserGuid =CAST(@userGuid ASVARBINARY(128))

SETCONTEXT_INFO @binUserGuid


From now on you will be able to query the data as if you would be logged in as another user.

To clear the context info simply execute

SETCONTEXT_INFO 0x


I hope this helps those who are testing SQL queries for the CRM reports.


Источник: http://a-crm.blogspot.com/2017/08/ex...-database.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.