AX / D365FO – Get datasource from a Form extension class

At Form Level [ExtensionOf(formStr(SalesTable))] final class KSSalesTableFrm_Extension { public int active() { FormRun formRun = this as FormRun; //get any datasource from the base form FormDataSource salesLine_ds = formRun.datasource(FormDatasourceStr(SalesTable,SalesLine)); SalesLine salesLine = salesLine_ds.Cursor(); //get any formcontrol from the base form FormControl itemName= formRun.design().ControlName(FormControlStr(SalesTable, itemName)); //business Logic return next active(); } } At FormDataSource level [ExtensionOf(formDatasourceStr(SalesTable, … Continue reading AX / D365FO – Get datasource from a Form extension class

SQL SERVER – Find where specific table or view is used in SQL Server database

select schema_name(o.schema_id) + '.' + o.name as [table], 'is used by' as ref, schema_name(ref_o.schema_id) + '.' + ref_o.name as [object], ref_o.type_desc as object_type from sys.objects o join sys.sql_expression_dependencies dep on o.object_id = dep.referenced_id join sys.objects ref_o on dep.referencing_id = ref_o.object_id where o.type in ('V', 'U') and schema_name(o.schema_id) = 'dbo' -- put schema name here and … Continue reading SQL SERVER – Find where specific table or view is used in SQL Server database

SQL SERVER – Auto Generate INSERT Statements For A Table In SQL Server

To generate insert scripts for inserting data to a table on production environment or populating a test environment database follow this procedure In SQL Server Management Studio (SSMS), there is an option to easily auto generate insert statements on the fly. Below are the steps to generate insert statements using SSMS. In SSMS Object Explorer, right-click the database. … Continue reading SQL SERVER – Auto Generate INSERT Statements For A Table In SQL Server

SQL SERVER – How to increase the maximum number job history logs

By default the maximum number of logs stored in the SQL SERVER Agent history is 100 All the previous jobs stored after that value are automatically deleted If you need to store more logs in your history follow these instructions : In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand … Continue reading SQL SERVER – How to increase the maximum number job history logs

SQL SERVER – HOW TO : TEMPDB won’t shrink even if there is unused space available

It could happen that the TEMPDB grows and even if you try to shrink it the size does not decrease. The problem could be caused by cache data not being cleared. In this cases you could use some commands that clear these cached data. Read this article to understand what you can do in these … Continue reading SQL SERVER – HOW TO : TEMPDB won’t shrink even if there is unused space available

SQL SERVER – Create an Alert for TEMPDB Growing out of control

The system database TEMPDB can appear to have a life of its own. The primary purpose of this database is to temporarily store data for specific processes before being committed to a database. When a Tempdb grows out-of-control it can be a daunting task trying to figure out what is causing the growth. This can … Continue reading SQL SERVER – Create an Alert for TEMPDB Growing out of control