AxBuild.exe compilation error

Yesterday when i try to compile my AX 2012 R3 with AxBuild.Exe, i was getting the following error

“Object Server 01:  Can not create default Keyset. Error code -2146893809”.

Here i was running the command prompt as an Adminitrator and user has the access to AX database. After going through some of sites online i found out that, the issue has been caused by user permission.

The AOS was running under different user account and i was trying to run the compilation with other user account.

When I log off this user and logged in as the same user under which the AOS service is running and then started the compilation. And this the compilation is successful.

 

Posted in Microsoft Dynamics AX | Tagged , , , | Leave a comment

AX2012 R3 demo data transfer tool not detecting the database

Hello Friends,

Today i have tried to import the demo data into my AX 2012 R3 instance. But the test data transfer tool is not detecting my database. It is always showing that no databases found, even though the database exists and i am able to view my AX console without any issues.

After 2 hours of debugging, i found the following query

SELECT NAME FROM sys.sysdatabases where sid != 0x01 and version is not null AND DATABASEPROPERTYEX(name,’status’) = ‘ONLINE’ order by crdate desc

The tool is searching for the databases which are not created by sa user. But some how my database was created by the user sa when i was installing the AX. Because of this issue i am unable to import the demo data to AX instance.

Then i have executed the following steps to resolve my issue.

  • Make a back up of the AX database
  • Delete the existing database
  • Login to SQL management studio with windows authentication and restore the same database from the back up file,
  • Give the required user permissions to the database (if applicable).

Done. Now i am able to import the demo data successfully.

Posted in Microsoft Dynamics AX | Leave a comment

Getting Vendor addresses based on Address type in AX 2012 R2/R3

The following query gets the vendor addresses

 select ROW_NUMBER() over (partition by v.accountNum order by dpl.isprimary desc, lpa.recid) as AddressNumber,v.ACCOUNTNUM,lpa.ADDRESS,llr.NAME from VENDTABLE V
 join DIRPARTYLOCATION Dpl on v.party=dpl.party  and dpl.ISPOSTALADDRESS=1
 join LOGISTICSPOSTALADDRESS lpa on dpl.LOCATION=lpa.LOCATION  
 join DIRPARTYLOCATIONROLE dplr on dplr.PARTYLOCATION=Dpl.RECID
 join LOGISTICSLOCATIONROLE llr on dplr.LOCATIONROLE=llr.RECID
 where llr.TYPE=10 — Can be any type as per requirement

Posted in Microsoft Dynamics AX | Leave a comment

Resize the VHDX file

The following process changes the VHD file size using the power shell (run as administrator).
  1. mount-vhd –passthru | get-disk | get-partition | get-volume
    • This will mount the virtual hard disk in the management operating system, and let you know the drive letter that was assigned to it.
    • Ex: mount-vhd F:\MYVHD.vhdx –passthru | get-disk | get-partition | get-volume
  2. resize-partition –driveletter –size
    • This will resize the partition inside the virtual hard disk.
    • Ex: resize-partition –driveletter I –size 60GB
  3. dismount-vhd
    • Dismount the virtual hard disk after shrinking the partition.
    • EX: dismount-vhd F:\MYVHD.vhdx
  4. resize-vhd –ToMinimumSize
    • Now shrink the virtual hard disk to match the new size
    • EX: resize-vhd F:\MYVHD.vhdx –ToMinimumSize
Posted in Windows | Leave a comment

How to remove windows default apps in Windows 8, 8.1 and 10

Step 1
Open power shell as an Administrator


Step 2
Type the command Get-AppxPackage. It  will show the list of windows apps.

Step 3Now choose the application which you want to remove. Select the Package full name and type the following command. 


remove-appxpackage “package full name” -confirm


For example, to remove the xbox application use following  
remove-appxpackage Microsoft.XboxApp_5.6.17000.0_x64__8wekyb3d8bbwe – Confirm

Xbox app will be removed..

Posted in Windows | Leave a comment

SQL server Multiple rows to one comma separated value

This is the select statement in Sql server which will select the multiple rows of a column into a single column and single row as a comma separated values.

SELECT  ID ,STUFF((SELECT ‘, ‘ + CAST(Name AS VARCHAR(10)) [text()] FROM Customer WHERE GroupId = t.ID FOR XML PATH(”), TYPE).value(‘.’,’NVARCHAR(MAX)’),1,2,’ ‘) List_Output
FROM CustomerGroup t
GROUP BY ID

You can test the functionality here http://sqlfiddle.com/#!6/1cda0e/4

Posted in SQL Server | Leave a comment

Sql Sever Split String function with special character support

The following the is the SQL server table valued function which will return the result as table. The input to the function is string delimited with the comma (for that matter any character which is is not part of the string it self) and the delimited character. This will also work even if the special characters present in the given input string.

1. Function

Create FUNCTION UdfSplitString
(
   @String       NVARCHAR(MAX),
   @SplitChar  NVARCHAR(255)
)
RETURNS TABLE
WITH SCHEMABINDING
AS
   RETURN 
   (  
      SELECT Item = y.i.value(‘(./text())[1]’, ‘nvarchar(4000)’)
      FROM 
      ( 
        SELECT x = CONVERT(XML, ‘<![CDATA[‘ 
          + REPLACE(@String, @SplitChar, ‘]]><![CDATA[‘) 
          + ‘]]>‘).query(‘.’)
      ) AS a CROSS APPLY x.nodes(‘i’) AS y(i)
   );
GO


2. Select Statement

Select * from UdfSplitString(‘1,2,3,*@#$~!%^&*()-+=_{}|’,’,’)

You can also test the functionality from the following link. http://sqlfiddle.com/#!6/e667f/3/0

Posted in SQL Server | Leave a comment