Category Archives: SQL

How to add the Mobile Phone and Private Phone fields to the views being used by Find screens, Reports and Groups

This blog explains how one can fetch different categories of phone numbers and Email addresses tagged against particular person to display in Report, Find Screen and groups in CRM. First let me explain the structure of Phone and Email entities in CRM. Refer the below given details. After understanding the relationship between entities specified in… Read More »

How to access views of Different Database in CRM

Recently I encountered a situation wherein I had to fetch records of Views and display the same, but from a database other than the CRM default database. It took some time to think about the way to accomplish my requirement and then after some researching I came up with the solution. The solution to tackle… Read More »

Enable CLR for SQL

Are you getting the below mentioned errors while executing user defined components on SQL? 1. Exceptions like ‘Message=Execution of .NET Framework code is disabled. Set “clr enabled” configuration option and restart the server.   2. Execution of user code in the .NET Framework is disabled. Enable “clr enabled” Enable “clr enabled” configuration option These errors… Read More »

Simple split function in SQL

Most of the times while designing procedures and cursors for customization you may need to use a function which will split your string based on predefined delimiter and return you items set. Below is the function you can create and use in SQL for the same. CREATE FUNCTION dbo.Split(@String nvarchar(4000), @Delimiter char(1)) returns @Results TABLE… Read More »

OSQL error at the time of installing CRM

You must have come across the above mentioned issue when installing CRM on multiserver architecture where Application server and Database server are two different machines on the network. This error occurs at the time of installing CRM on Application server. This issue seems to be related to the database connectivity across the server, but what… Read More »

Cannot open database requested by the login. The login failed.

Have you ever encountered this error message “Cannot open database [XXXX] requested by the login. The login failed. “ While installing CRM patches with SQL Server and MSSQL services both available on the same SQL server??? As the error says there might be many reasons for it to not to connect to database like network dis-connectivity,… Read More »

Executing Stored Procedures using COM API methods

This is developer specific technical tip which can be used in CRM customizations. In customizations we usually execute sql statements using CreateQueryObj function. For Eg. SqlQuery = “Select comp_name from company (nolock) where comp_compname=”+sCompId; SqlObj = eWare.CreateQueryObj(SqlQuery); SqlObj.SelectSQL(); Here to retrieve the value of comp_name we can use SqlObj(“comp_name”). The above example is for the… Read More »