July 2006 - Posts - Derek Adkins

July 2006 - Posts

SQL Stored Procedure problem

I have an interesting problem that I'm trying to solve elegantly.  Maybe one of you has a nice solution for me:

Consider this table date from an "user authority table"

UserCustomerAccountCost CentreRegistration
GeorgeDerekDerek AccNullNull
GeorgeBobBob AccBob CcntrNull
GeorgePamNullNullNull
GeorgeSueSue AccSue CcntrABC123GP

Now I want to select all allowed registrations for George.  Reading each record and processing according to the above authorities.  In the above example, George should see all Derek's vehicles in the above account level, All Bob's vehicles in the above cost centre, all Pam's vehicles regardless of where they are and only ABC123GP from Sue.

I have another table that links each vehicle to a certain customer, account, cost centre.  So you can't join on the NULL fields because this other table has valid values for each column.

Is this possible with a single select statement?  How would you achieve this?  I've tried using a cursor, but for some reason the AS/400 SQL that I'm trying to use doesn't recognise @@FETCH_STATUS as a valid variable.

Viewing webpages in IE... inside Firefox!

If you're like me and prefer Mozilla Firefox to Internet Explorer, then get this:

IE Tab for Firefox and be able to see how pages look in IE and Firefox both as tabs in Firefox.  This is great for development as you can go back to using one browser now.

I'm going to test this straight away with this blog editing page as I know it has issues in Firefox.

UPDATE: Sorry.. my bad. I see that it works fine now in Firefox. When was that corrected?  Nice one! :)

Found here: http://thewpfblog.com/?p=32