Ava Blog

Microsoft Baseline Analyser and other errors

Wednesday 01 September 2010 by Ian Pettman

Problem solving with SQL2008R2: or who put the Anal in R2 best practise analyser?
There is a new kid on the block and it's called SQL 2008 R2 Best practices analyser. Even by Microsoft standards the install is somewhat fraught. Do they ever test these installs? However the end result should be automatic testing of your installs for best practise - and that has to be good.


The steps are: download and install Power shell 2.0 ( its now called Windows Management Framework Core)
http://www.microsoft.com/downloads/details.aspx?FamilyId=f2fa1227-9a34-4e29-aa03-62f5c00e16f2&displaylang=en
You may be prompted for an update on Vista:
The Windows Management Framework BITS package provides updated management functionality for IT Professionals.
http://www.microsoft.com/downloads/details.aspx?FamilyID=d7ae9660-bb13-4f0c-816b-85de3980ec1b&displaylang=en&Hash=bT%2bM0D5bmCtAsBdCdyuVotjBveBjfO%2bEw%2fy3nnAnr53M3oDmlTDZocV1wxhHc5eqLjQ%2bzaHNaq5WTk9AtetwdA%3d%3d
You can then install Microsoft Baseline Configuration Analyzer 2.0
http://www.microsoft.com/downloads/details.aspx?FamilyID=1B6E9026-F505-403E-84C3-A5DEA704EC67&displaylang=en
Which then allows you to install (sorry download because there is a known issue here) the R2 best practise analyser
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=0fd439d7-4bff-4df7-a52f-9a1be8725591
You will almost certainly hit a "there is a problem with this windows installer..."
The work round is to run the installer from the command line as described here:
http://blogs.msdn.com/b/psssql/archive/2010/06/21/known-issues-installing-sql-2008-r2-bpa-relating-to-remoting.aspx
You will then find the shortcut in startmenu / programs

 

If like me you are running this on a local (fuly service packed) vista machine to test agains a Local instance of 2008 R2 Express, then you will probably get the following message:

 

Baseline Analyser

 

Ok, so I right mouse click and "run as" adminsitrator.

Still no luck.

So i fire up power shell (rt click - run as adminsitrator) and paste an run the scripts in 2 and 3

2. Helpfully tells me all is enabled

Sage Instant Accounts Invoice Template Help

Tuesday 17 August 2010 by Ian Pettman

As many of our customers using our Temp Staffing software also use Sage accounting packages, we occasionally like to publish help articles on various aspects of using Sage.  This article recently published by Ava Ltd shows how to configure the custom invoice templates in Sage Instant Accounts to produce company headed invoices.  This eliminates the need to use either Sage stationery or headed paper for the invoices that you send out to your customers. The information is free and set out using step-by-step instructions and screen shots.

 

If you are experiencing a particular problem usingSage Instant Accounts that you would like to see an article on , please contact us here and let us know.

 

Back to Ava Sage Instant Accounts help menu...

Sony VAIO problems again.... This time it's the external monitor

Thursday 15 July 2010 by Ian Pettman

FAQ help for Temp Nursing Agencies on NHS AIMS setup has been updated

Monday 05 July 2010 by Ian Pettman

The FAQ help article on setting up AIMS export (demanded by Buying Solutions). This is for NHS trusts from Temp Nursing Agencies has been update to include reminders to set up NI and WTD rates for correct calculation of the Agency Free here...

Updates to Free applications and software packages for home, agency and staff bank use

Wednesday 30 June 2010 by Ian Pettman

Well that page was getting just too large. We have split it up:

General free applications and software

Free antivirus software

Free graphics and drawing programs

Free backup

 

London weighting for AIMS

Tuesday 29 June 2010 by Ian Pettman

The entry in FAQ Ava PA NHS ESR payroll and AIMS for Buying Solutions has been ammended to include the step for London weighting

Setting up or configuering hiding avalailability for overlapping shifts

Thursday 24 June 2010 by Ian Pettman

There is a new how to article explaining the following:

how to set up or configure hiding availability for overlapping or adjacent shifts.

For example:
Someone was noted as being available for a Night shift, Early shift the following the night and also a Long Day the following that night shift (i.e Long Day the next day).
When you booking them in to the night shift:
Ava PA automatically hides the following day's Early and Long Day availability.
Cancelling the Night shift: Ava will automatically re-display the following Early and Long Day availability again.

The article explaining setting up or configuring the hiding of availability for overlapping shifts is here.

 

Sage instant accounts for dummies

Tuesday 15 June 2010 by Jill Varley

Here at Ava we like to make things easy for our customers, some of whom use Sage instant accounts in conjunction with their Temp Staffing Software / Staff Bank software for running their accounts. From time to time we will publish articles on interfacing accountancy software with Ava pa software. We have just published a new article on Invoicing using preset templates in Sage instant accounts.

Addition to free applications page

Sunday 23 May 2010 by Ian Pettman

Ever so often we update the free applications page.

There is a new addition to the list of useful, worthwhile freely available products.

This update is for graphics packages.

 

 

Use of foreign keys

Friday 21 May 2010 by Ian Pettman

I partake in several forums related to software development, database design and problem resolution. It ultimately helps improve our service to our Temp Agency and Staff Bank software customers.

Occasionally there are comments or threads that are (in my opinion) really well balanced appraisals of fundamentals. Kenneth Wilhelmsson recently wrote one such contribution and has kindly given permission for its reproduction here. I believe I am correct in saying Kenneth has been contributing wisdom to at least one of the major forums in the SQL community for around a decade.  I have taken the liberty of correcting the very occasional typo as this was initially contributed 'on the fly' to a SQL forum. 

Thank you Kenneth

 

Kenneth writes on use of foreign keys

Well, this is indeed an interesting subject. :o)
I'll try to ramble a bit in the philosophical vein...
This is also just my .02, so feel free to agree or disagree =;o)
First and foremost, I want to make clear that we don't 'use' keys.. They are there, whether we can see them or not.
Keys are a part of the model, so the concept of a key is abstract. A key is *not* an index or a constraint.
Regardless of prefix, such as 'primary', 'foreign', 'alternative' etc etc, a key is - a key - nothing less and nothing more. They are all the same in this respect.
 
Now, usually the debate is around how to *implement* keys in the best way. This is where we stumble into the realms of indexes, constraints et al. 
A quick demo: consider my table here:

 
CREATE table myTab ( col1 int not null, col2 int not null, col3 not null )

 

Now, if I were to say that this table has one primary key and one foreign key... Would I be lying?
No, I wouldn't. It is so, because I have designed the table and have also decided where my keys are.
The problem is though, that one can't see this without directly asking the designer (me).
This isn't very helpful, so it'd be better to document the keys in some way.
Also, there isn't anything visible at the table level that actually helps to enforce that my keys really do behave like keys.
How to do it then?
 
If nothing more is done, the keys are still there.  (They are part of the model/design remember?)
It's however a great risk that the table will become corrupted very quickly.
'Corruption' in this sense is when you end up with data that isn't conforming to the keys present, i.e. a duplicate or an orphan or any anomaly not intended.
 
So, one better need to implement these keys in some way, by placing the rules wanted at some level between the data and the 'other end' - i.e. input/output side.

 

At this point there may be a debate concerning 'performance', and you now have the two camps noted earlier.
I would argue that performance is always secondary to integrity, so better do it 'right'... or 'corruption' will happen.

 

Now, if we decide to place the rules far away from the data, then this will probably work for the purpose of keeping integrity...  as long as this path is *ALWAYS* used! In reality though, the farther away from the data DRI are placed, the higher the risk that someday, something, willingly or unwillingly something will slip into our database without passing those rules. This is one of the major downsides to 'application enforced DRI' - distance. Another downside is that the tables usually look like my example above. It doesn't tell you much information:  you have to go to the upper layer and start to unwind the app to figure out what the intentions really are. And, there's also the chance of actually *missing* on performance gains (regarding FK's, more on this later).
 
Perhaps it make for better sleep at night if the DRI is placed as close to the actual data as possible?
There's usually no debate regarding the key that is designated as 'primary'.
 
CREATE table myTab ( col1 int not null, col2 int not null, col3 not null )
CREATE unique index myInd on myTab(col1)
 
This would suffice as far as DRI on my designated PK is concerned.
It's however still not very informative. One can't really be sure what this is, except that it now behaves like a key.
Another thing that is now demonstrated is that our most efficient tool to implement a key is with the help of a unique index. (Clustered or not has absolutely no relevance in this regard.)
 
So, to better communicate our intentions, we can declare a constraint.
 
CREATE table myTab ( col1 int not null, col2 int not null, col3 not null )
ALTER TABLE myTab ADD CONSTRAINT myInd PRIMARY KEY (col1)
 
Now there's no question about what kind of key it is.
The declaration clearly informs that it's designated as 'primary' it is a 'key' and it uses an index to enforce the behaviour such a key should have.
 
Ok, so similar concept for other kinds of keys, such as Foreign Keys.
ALTER TABLE myTab ADD CONSTRAINT myFK FOREIGN KEY (col3) REFERENCES someOtherTable(colX)
 
This tells us clearly that there is a relation here with a foreign key (information) and it's tightly coupled to the table (reliable)
In essence a FK constraint is a CHECK constraint, and this is where it gets interesting performance-wise...
 
A check constraint (i.e. our FK here) can be one of two things: 'trusted' or 'not trusted'.
Try issuing this query:

 

SELECT OBJECTPROPERTY(object_id('FK_name'), 'CnstIsNotTrusted')
 
If it returns a zero (false), all is well. If it returns a 1 (true) then we have some issues.
Very briefly, if you create/enable a FK constraint *with validation* of existing data, then it will be 'trusted'
In all other cases it will be 'NOT trusted'
 
This is a huge issue for the optimizer among other things, and if done properly, may yield performance benefits as an added bonus.
For the absolute most parts, one would like to have all FK constraints to be trusted.
It means we can rely on it, and that there are no orphans present, for sure.

If it's not trusted, then we won't know for sure, and neither will the optimizer. It may even disregard the constraint altogether when it looks for a plan, resulting in a less optimal plan overall than otherwise.

If it is trusted, the optimizer also trusts this intelligence, and as a side effect may produce a plan that doesn't even touch the table that the FK references, even though the actual query may say something like:

 

SELECT a.col2 FROM myTab a JOIN someOtherTab b on a.col3 = b.colX

 

It depends on what is needed to be retrieved.
If a.col2 is sufficient, then why bother go see if a.col3 ties up with b.colX if the constraint which is present has already done this check? (This is assuming it can be trusted of course.)

So, for possible performance benefits, this is one that may happen in certain circumstances. At any rate, it's a benefit. It also would never ever occur when the DRI is placed at the application level. So, to end this, if anyone has persisted this far.. =;o)

I'm pro the camp that proclaims DRI enforcement at the database level.
It makes me sleep better =;o)
 
/Kenneth

Contact Information

To find out more about Ava solutions you can contact us in a number of ways: