Monday, 18 February 2019

Creating Your Own Run Commands

  • Win+R to open the Run dialog 
  • Enter %windir% to open the Windows directory
  • Create a shortcut to the desired program or Move the short cut to the above folder 
  • The name you give the shortcut is what you type in the Run dialog to start the program

Thursday, 14 February 2019

SQL Server Reindexing Query (by Table)

The below query to reindex the SQL Server database index by table

DECLARE @TableName VARCHAR(255) 
DECLARE @sql NVARCHAR(500) 
DECLARE @fillfactor INT 

SET @fillfactor = 80 

DECLARE tablecursor CURSOR FOR 
  SELECT '[' + Object_schema_name([object_id]) + '].[' 
         + NAME + ']' AS TableName 
  FROM   sys.tables 
  ORDER  BY NAME 

OPEN tablecursor 

D365 V9 CRM SDK

This Powershell script will be used to download the SDK tools from the nuget site.

$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$targetNugetExe = ".\nuget.exe"
Remove-Item .\Tools -Force -Recurse -ErrorAction Ignore
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
Set-Alias nuget $targetNugetExe -Scope Global -Verbose

##
##Download Plugin Registration Tool
##
./nuget install Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -O .\Tools
md .\Tools\PluginRegistration
$prtFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.'}
move .\Tools\$prtFolder\tools\*.* .\Tools\PluginRegistration
Remove-Item .\Tools\$prtFolder -Force -Recurse

Tuesday, 12 February 2019

SQL Server Row count on all the tables

This SQL script is used to get the number of records in each tables

SELECT o.NAME, 
       i.rowcnt 
FROM   sysindexes AS i 
       INNER JOIN sysobjects AS o 
               ON i.id = o.id 
WHERE  i.indid < 2 
       AND Objectproperty(o.id, 'IsMSShipped') = 0 
ORDER  BY o.NAME