Thursday, 13 August 2015

Custom barcode and MICR fonts on SSRS reports from AX 2012 display correctly but will not print or export

So with AX 2012 you may want to display a custom, barcode, or micr font on a report to print for the bank or factory floor. By default a lot of these fonts get installed but some do not. What I have found out is that it will display correctly within the report window but whenever you try to print it or export it does not export the font correctly. In order to resolve the issue the following needs to be done
  1. Install font on AOS
    1. If you are running an AX Cluster be sure to install it on all AOS's
  2. Install font on SQL/SSRS box
    1. If you are running a SQL cluster be sure to install it on all AOS's
  3. When installing be sure to install the font thru the control panel>fonts and not C:\windows\fonts for some odd reason windows server 2012 R1+ does not always install the font correctly when you copy to the specific folder but it does if you use the control panel
  4. Reboot SQL boxes
  5. Reboot AX AOS boxes


If this does not work try reinstalling the font thru the control panel.

Tuesday, 4 August 2015

Fixing database is in use error while restore database from backup

Method 1
declare @sql as varchar(20), @spid as int

select @spid = min(spid)  from master..sysprocesses  where dbid = db_id('<database_name>')
and spid != @@spid  

while (@spid is not null)
begin
    print 'Killing process ' + cast(@spid as varchar) + ' ...'
    set @sql = 'kill ' + cast(@spid as varchar)
    exec (@sql)

    select
        @spid = min(spid)
    from
        master..sysprocesses
    where
        dbid = db_id('<database_name>')
        and spid != @@spid
end

print 'Process completed...'


Method 2

select spid from master..sysprocesses where dbid =db_id('<database_name>') and spid <> @@spid


SELECT *
FROM sys.sysprocesses
WHERE dbid = DB_ID('<database_name>')