Connect SQL Operations Studio For Mac to a SQL Server in Parallels VM


I’m slowly moving away from Windows. However, being a Microsoft Dynamics GP consultant, that’s not entirely possible. I’ve been working hard to overcome every single roadblock since the last couple of years.

One major gripe, among several others, was the inability to connect the SQL Server instance on my Windows 10 virtual machine, mounted using Parallels. Until now.

Microsoft released SQL Server Operations Studio, which is still under preview, for us to connect to a SQL Server from Windows, Mac OS or Linux. I now have the choice to work from either my Mac OS or my Windows 10 VM.

However, there are some steps we must follow to successfully connect to a SQL Server instance on a virtual machine. This post, from Anton Sizikov, is probably the easiest one to follow. Following the steps explained on this post, Connecting SQL Operations Studio to SQL Express Server in Parallels VM, I was able to successfully use my SQL Server Operations Studio to connect to my VM SQL Server. Below is the SQL Ops Studio in all its “dark theme” glory:

Screen Shot 2018-05-16 at 16.18.41

I couldn’t use my Mac more than pretty much for just browsing, emailing and other daily digital chores. This is one huge step forward to start utilising it well.

Vaidy

 

Advertisement

SQL Server Backup Files Cleanup


I learned something interesting today. Something so simple yet crucial. Alright, let me jump straight on to it.

After going live with GP2015R2, as part of SQL maintenance tasks, I created daily backup schedule in SQL Server. Client’s backup retention policy is 3 prior days. So I created a “Maintenance Cleanup Task” to remove all backup files that are older than 3 days.

All good. Only that, it didn’t work. And we realised that only yesterday. Bummer. Thankfully, it was a new server so we had plenty of space. And size of DBs are quite small. So I could see backup files dating yesterday. Which is nice.

I had to figure out what’s going wrong all this time. It’s a fairly simple setup. Nothing complex. Something must be wrong. I opened the maintenance task definition window. Shown below:

Screen Shot 2016-02-23 at 8.55.04 AM.png

Looks perfectly alright to me. Isn’t it? But nope. Something makes this task fail every night.

When I looked at this post, Maintenance Cleanup Task (Maintenance Plan), on Microsoft MSDN site, I could not get much help from. It was good, detailed, but not good enough to help me why my task fails every night.

I then did something that I thought is weird, but turned out to be the solution.

I changed the File extension value from .bak to just bak, as shown below:

Screen Shot 2016-02-23 at 8.55.04 AM.png

Saved the definition and ran the task manually to check if it worked.

Voila… It worked…!!!

Those who are reading this and thinking about why I am blogging something as simple as this (as if I found the god particle), well in all honesty, I had absolutely no idea about this till now. Just thought I would share this, as I always do. So please be nice on me.

VAIDY

Changing SQL Server Collation After Installation


I had a necessity to change the collation of newly created SQL server instance from CI_AS to CP1_CI_AS.

To brief you about why this was needed, I wanted to test upgrade GP from version 2010 RTM to 2010 SP3. In order to that, I created a new SQL server instance with collation SQL_Latin1_General_CI_AS. I restored GP 2010 RTM backups on to this newly created server. But later realised that GP databases that I got for 2010 RTM was of collation SQL_Latin1_General_CP1_CI_AS.

There were two options. Either I must change the collation of databases to CI_AS or I must change the server collation itself to CP1_CI_AS. Later seemed to be a better option (for some reason, I wanted to retain the collation on the databases). I was left with changing the collation of server instance.

That’s when I got this link: Changing SQL Server Collation After Installation

I was worried about the whole process but this post saved me loads of time and sweat. Changing the collation was a breeze.

Anybody out there who is looking for the best possible method to change server collation, above is the post you would want to read.

VAIDY

CBM Cash Receipt AA Journal Issue & Resolution


Couple of days back, a user reported an issue. When she tried to open CBM Cash Receipts window, following message appeared:

Screen Shot 2014-11-25 at 5.48.52 PM

For all other users, when they posted any Cash Receipt, an Analytical Accounting Journal report would open with some entries on it; particularly with 5 cash receipts. User, who reported the issue, confirmed that the records shown on AA journal report were posted by her and only after posting them, the above error message appeared.

Since the report is AA journal, I first checked the AA Sub Ledger tables (AAG20000 series) and confirmed that the entries shown on the AA journal report are present without any issues. If I get rid of the above error message, things would be normal and this particular user can continue with her entries. Task on hand is to find out AA journal report tables and see the stuck/orphaned records and clear them.

Issue: Records got stuck on AAG50000 (AA Sub Ledger Report Header), AAG50001 (AA Sub Ledger Report Distribution) and AAG50002 (AA Sub Ledger Report Assignment) tables.

Resolution: Remove them. Simple. What you MUST note here is that all records (including genuine ones) would be present on these tables. You MUST note down AA Sub Ledger Header ID of the ones that are stuck and use below query to delete records.

DELETE AAG50000 WHERE aaSubLedgerHdrID IN (<aaSubLedgerHdrID>,<aaSubLedgerHdrID>,...) 
DELETE AAG50001 WHERE aaSubLedgerHdrID IN (<aaSubLedgerHdrID>,<aaSubLedgerHdrID>,...) 
DELETE AAG50002 WHERE aaSubLedgerHdrID IN (<aaSubLedgerHdrID>,<aaSubLedgerHdrID>,...)

Replace <aaSubLedgerHdrID> with respective AA Sub Ledger Header ID of the stuck records.

NOTE: Always take a backup of records before you delete.

VAIDY

Simulate DEX_ROW_ID in a SQL View Using ROW_NUMBER() – #MSDYNGP


I have a requirement in which I have to access a SQL view from within my customisation dictionary, in order to create a custom lookup for users to select a value based on an Extender form and an Extender lookup. Easiest option is to create an Extender view (which in turn creates a SQL view for us).

Now, this is the view that I am suppose to refer to from my custom dictionary. Dexterity allows us to refer to any SQL object by simply create a TABLE definition and mention the SQL object (table or view) name as the physical name.

Dex View

Everything looks perfect till you actually see below error messages at runtime:

Dex View - Error 1

Dex View - Error 2

Error message is quite obvious; you do not have DEX_ROW_ID in that SQL view that you are referring to. Every single Dexterity table must have DEX_ROW_ID at the backend. It cannot afford to not have one.

So how am I going to resolve this? By simply adding a record number dynamically to the SQL view created by Extender. How to do that? By adding the T-SQL function ROW_NUMBER(). This is how I achieved it:

ROW_NUMBER USAGE

 

Definition of ROW_NUMBER() can be found here: ROW_NUMBER (Transact-SQL).

A simple yet powerful SQL function has given me the power to do what I wanted in no time. Oh, and my custom lookup referring to this view is working like a charm. Users are happy and so am I.

VAIDY

syExcelReports Table & SQL Server Native Client 10.0 – Thanks Aaron Berquist


While upgrading our GP from GP2010 SP3 to GP2013 SP1, DYNAMICS database upgrade stopped unexpectedly with GP crashing without any information for me to debug.

But it stopped exactly at table syExcelReports and crashed. Without spending anymore time, I just went and checked my ODBC DSN setup, as explained by Aaron Berquist on his blog High Dynamics Range. Expectedly, the ODBC DSN driver was not pointing to SQL Server Native Client 10.0.

For some reason, GP fails to process upgrade further if your DSN driver is NOT native client 10.0 or above.

Those who upgrade your GP to latest version, please check DSN before you start database upgrade using GP Utilities.

VAIDY

DBCC SHRINKFILE


There is an amazingly simpler yet highly informative post up on TECHNET portal, which proved very handy this morning.

My systems admin reported to me that our SharePoint server ran out of storage for some reason unknown to him, but he could identify that it was SQL Server program files folder which consumed 80% of storage.

I immediately knew what could be the reason. It’s those crazy log files problem. To truncate and clear these overeating log files, I had to use this command: DBCC SHRINKFILE.

SP-Log-FileGrowth

Once I cleared out all unnecessary file space from these log files, I had to setup the File Growth and Maximum File Size (shown in the screenshot beside):

Never for a DB log file, we should setup the file growth as “In Percent”. This would prove disastrous over a period of time. Instead, always set it up to “In Megabytes” and enter a least sensible value; in my case I had set it up to 5MB.

For a DB Log file, 2GB should be reasonable amount of file space to hold the logs. To learn more about Log files, read this post on TECHNET: The Transaction Log (SQL Server).

We must understand one thing, that shrinking the DB log has got it’s own impact.

VAIDY

Implicit Conversions Causing Deadlocks in SQL Server


Quite an interesting but crucial post up there on Sans SQL blog.

The post explains that Implicit conversions in SQL Server could actually trigger a deadlock. And there are definitions for each important term (such as deadlock, implicit conversion, etc.) with an example.

I believe this post would be useful for those who work extensively on SQL Server.

VAIDY

T-SQL Function for Proper Case Format


We do not have a built in T-SQL function to convert any string (or a statement) to Proper Case format, also known as Title Case. This I feel is a very simple feature that SQL Server could have provided us, but missing even in it’s latest version, SQL Server 2012.

I thought I would highlight some links which would be useful for T-SQL programmers in our community:

  1. David Wiseman’s Solution
  2. Jeff Smith’s Solution
  3. Pinal Dave’s Solution

There are many more solutions, but above are noteworthy.

VAIDY

Quick SQL Tip: Keyboard Shortcut for Database Selection in SQL Server 2012 SSMS


Till SQL Server 2008 R2, if you want to change the database on which you would like to execute a SQL query in SQL Server Management Studio (SSMS), the keyboard shortcut to do so was CTRL + U from the query window.

Now from SQL Server 2012, it is CTRL + ALT + J.

So those who tried this using the old shortcut, keep in mind that the new shortcut.

VAIDY