Softchief Solutions

Technologies | Life Tips | Socials & Everything

SQL Query Snippets

Query to Retrieve Optionset Value and Text

SELECT AttributeValue,Value
FROM StringMap s
   INNER JOIN EntityLogicalView e ON s.ObjectTypeCode = e.ObjectTypeCode
WHERE e.Name = ‘<entityname>’ and s.AttributeName=’
<optionsetcolumnname>’

-OR-

SELECT firstname, lastname, gendercodename
FROM FilteredContact
WHERE contactid='<ContactGUID>'

Check Blocked Processes

SELECT * FROM sysprocesses 
WHERE spid in (select blocked from sysprocesses) 
or blocked > 0

Exec sp_WhoIsActive @delta_interval = 2, @get_plans = 1,  @get_task_info = 1    ,@show_sleeping_spids = 1

Set TimeOUT Value

USE MSCRM_CONFIG
GO
--UPDATE DeploymentProperties SET IntColumn=9000 WHERE ColumnName=’SqlCommandTimeout’

select top 10 * 
from DeploymentProperties
WHERE ColumnName='SqlCommandTimeout'

Please comment reusable queries for developers if you know more.

%d bloggers like this: