Extract ABR Transactions For Import As Statement

Microsoft Dynamics GPthis is a simple script, but I’ve written it about four times now so I figured I’d post it so I can find it easily next time I lose my local copy.

Perfect Image are resellers of the Advanced Bank Reconciliation module from Nolan Business Solutions (along with the other add-ons they’ve written for Dynamics GP) and I often need to demo this replacement for the standard Bank Rec module.

One item I typically show is the auto-Propose function which matches transactions against statement lines in the Reconcile Bank Transactions window (Transactions » Financial » Advanced Bank Reconciliation » Reconcile Bank Transactions).

To do this I need to be able to import statement lines which match the transactions in Dynamics GP; the easiest way of doing this is to extract the transactions.

This can be done with a very simple SQL script:

SELECT
   ORPSTDDT
   ,ORDOCNUM
   ,TRXAMNT
   ,SOURCDOC
FROM
   NCABR012

Once the data has been extracted it can be imported during the demo using the standard ABR Import Statement routine.

SQL Server Cannot Start Following Maintenance

Microsoft SQL ServerI’ve just finished doing some maintenance on one of my development servers and encountered a problem where I could not restart the SQL Server. The development server was a virtual machine running on VMWare which had a second virtual HDD installed for SQL Server to store the database and log files. This disk had been provisioned at 200GB and over time had acquired a lot of files, such as database backups, which became unnecessary and had filled the 200GB.

I needed to get some of the space back on the VM host so I stopped the SQL Server, copied the SQL mdf and log files to a new HDD, deleted the SQL HDD and then set the drive letter of the new HDD to that of the old one.

I then tried to start SQL Server and received the following error:

Windows Event Viewer - FCB::Open failed: Could not open file E:\SQL208RTM\Live\DYNAMICS.mdf for file number 1. OS error: 5(failed to retrieve text for this error. Reason: 15105).Windows Event Viewer – FCB::Open failed: Could not open file E:\SQL208RTM\Live\DYNAMICS.mdf for file number 1. OS error: 5(failed to retrieve text for this error. Reason: 15105).

Continue reading “SQL Server Cannot Start Following Maintenance”

SQL Script To Locate Columns With Different Collation

Microsoft SQL ServerA while ago I posted about a problem with a collation conflict on a couple of columns in the Tax table. It seems I posted about how to fix the problem, but it seems I didn’t post how I found the problem columns.

I did this with a fairly simple SQL script:

DECLARE @Collation SYSNAME SET @Collation = 'SQL_Latin1_General_CP1_CI_AS'

SELECT
   TABLE_NAME AS 'Table'
   ,COLUMN_NAME AS 'Column'
   ,DATA_TYPE AS 'Data Type'
   ,COLLATION_NAME AS 'Collation Name'
FROM
   INFORMATION_SCHEMA.COLUMNS
WHERE
   DATA_TYPE IN ('varchar','char','nvarchar','nchar','text','ntext')
AND
   COLLATION_NAME <> @Collation