Category Archives: SQL

SageCRM Record Id generation old and new methods

How you design your database has huge effect on how your system performs. Primary key, foreign key constraints help to keep the tables linked to each other and store the data in unified manner. From long time SageCRM has followed strategy of generating primary keys through stored procedures rather than relying on the inbuilt primary… Read More: SageCRM Record Id generation old and new methods »

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 add the Mobile Phone and Private Phone fields… »

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: Enable CLR for SQL »

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: Simple split function in SQL »

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: Cannot open database requested by the login. The login failed. »

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: Executing Stored Procedures using COM API methods »