SQL SERVER – How to see query history in SQL Server Management Studio

This simple query shows the query history logs of the SQL DB SELECT t.[text], s.last_execution_time FROM sys.dm_exec_cached_plans AS p INNER JOIN sys.dm_exec_query_stats AS s ON p.plan_handle = s.plan_handle CROSS APPLY sys.dm_exec_sql_text(p.plan_handle) AS t WHERE t.[text] LIKE N'%something unique about your query%' ORDER BY s.last_execution_time DESC;

AX / D365FO – Simple Class to perform database sync for a single table

This simple runbase class is a ready-to-use tool to perform a Database synchronization for a single table Through X++ code we can perform database synchronization either on a required table (or) on all tables bases on our requirement. This could be very useful during on-premises environments package deployments because can can drastically reduce the downtime. In fact you can only synchronize the tables … Continue reading AX / D365FO – Simple Class to perform database sync for a single table

AX / D365FO – Perform database synchronization for a single table in X++

Through X++ code we can perform database synchronization either on a required table (or) on all tables bases on our requirement. This could be very useful during on-premises environments package deployments because can can drastically reduce the downtime. In fact you can only synchronize the tables that you have actually modified rather than perform an … Continue reading AX / D365FO – Perform database synchronization for a single table in X++

SQL SERVER – Remove special characters from string

Simple function to remove special characters from a string -- Remove special characters from String create function RemoveSpecialChars (@s varchar(256)) returns varchar(256) with schemabinding begin if @s is null return null declare @s2 varchar(256) set @s2 = '' declare @l int set @l = len(@s) declare @p int set @p = 1 while @p <= … Continue reading SQL SERVER – Remove special characters from string

SQL SERVER – Get numeric values from string

Simple function to get numeric values from a string -- Get numeric values from String CREATE FUNCTION dbo.udf_GetNumeric ( @strAlphaNumeric VARCHAR(256) ) RETURNS VARCHAR(256) AS BEGIN DECLARE @intAlpha INT SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric) BEGIN WHILE @intAlpha > 0 BEGIN SET @strAlphaNumeric = STUFF(@strAlphaNumeric, @intAlpha, 1, '' ) SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric ) END … Continue reading SQL SERVER – Get numeric values from string

AX / D365FO – How to add enum filter with “All values”

Sometimes customers request a specific filter in a form. The filter is based on an enum and must have All element to display all records regardless of field value. For example, a filter has 3 elements: All, Quotation, Order; although enum has only 2 elements: Quotation, Order. To achieve the result you need to add a ComboBox control in codeThe algorithm is the following:- … Continue reading AX / D365FO – How to add enum filter with “All values”

AX / D365FO – How to get values of base enums using code in x++

static void getEnumValues(Args _args) { EnumId enumId = enumNum(LedgerDimensionType); //Put here your enum DictEnum dictEnum = new DictEnum(enumId); int numOfValues = dictEnum.values(); //This method gets the total number of enum values int counter; for(counter = 0; counter < numOfValues; counter ++) { //You can use the number of method exposed by DictEnum class Info(strFmt('%1',dictEnum.index2Value(counter))); Info(strFmt('%1',dictEnum.index2Symbol(counter))); … Continue reading AX / D365FO – How to get values of base enums using code in x++