I've spent the last couple of weeks learning how to optimize the search tool we built. The short story is that we're now using a pass-through query in Access to pass parameters to stored procedures on SQL Server. Processing time has gone from about 2 minutes to less than 2 seconds.
Now that I know how to work with stored procedures, I'm thinking of how else to implement them with other types of applications.
BACKGROUND
The company has clients spread across multiple databases for various reasons; namely specific business rules (e.g., worker's comp rate, state tax rate, unemployment insurance, etc.) apply across an entire database.
Quite often someone in the company receives paperwork from an agency or client with nothing but the client employee's name or their SSN. Searching for this employee has been trial and error, going through each database at a time. Also, in many cases the person in our company just needs to see some basic information about the employee. For example, during tax season we just needed to verify a client employee's address and phone number. Hence the reason for such a tool.
We had initially designed the tool to have individual pass-through SELECT queries, uniting and applying criteria to them in Access. It was the uniting and applying criteria that has been slowing things down.
OPTIMIZING
So, I created two stored procedures with parameters: one that searches for an SSN one one that searches on a name. Each stored procedure unites the individual SELECT queries on a database separate from the other 12 that were being searched.
In VBA code, based on which criteria the user enters, we determine which stored procedure to run. We create a pass-through query to EXECUTE the stored procedure. This pass-through query then contains the search results, which is what we had with the earlier version of the tool.
PREVENTING SQL INJECTION
While reading the literature, I came across the concept of SQL injection and the need to prevent it. Since users are passing text to a SQL statment, we need to prevent the intentional or unintentional insertion of code that would prematurely terminate a text string and append a new command.
I wrote one procedure that scans what users enter in the first and last name fields for "--", "CREATE", and other such items. My coworker gave me some code to prevent users from entering other illegal characters. This double-barreled approach will prevent any SQL injection from occurring.
COMMUNICATING WITH THE MASSES
I enjoyed sharing the news of the updated tool with the rest of the company. I knew many had not even heard of it. I constructed the email the way I would a friendly blog post, including pictures.
One user immediately replied: "Awesome! Works very fast. Good job." I was contacted by two people in Accounting and Payroll who asked that I put the tool on their machines as well.
Much joy all around, I tell you. And IT looks good.
----------------
Now playing: Tim Hawkins - KidsRock
via FoxyTunes
Welcome to my online portfolio, the complement/substitute for my resume. The opinions included herein are my own and do not reflect those of any client or employer, past or present. Please check out the new site: http://danieljohnsonjr.com
- 401(k) report (7)
- accounting (1)
- administrivia (11)
- ADO (1)
- announcements (6)
- audio (1)
- batch files (1)
- benefits audit (2)
- blogging (8)
- branding (7)
- bridge application (17)
- business intelligence (7)
- cincinnati (6)
- client relations (4)
- community (1)
- competitive intelligence (2)
- conference (3)
- conversions (2)
- dashboard (3)
- data warehousing (1)
- design (4)
- documentation (2)
- financial reporting application (3)
- first post (1)
- get that job blog (2)
- global consumer products company (3)
- idea generation (2)
- integration manager (2)
- jazzmania productions (1)
- lessons learned (3)
- meetup (9)
- mentoring (3)
- microsoft great plains (5)
- music (2)
- nafta (1)
- networking (2)
- new media (22)
- payroll (6)
- peo (33)
- podcamp (3)
- podcampohio (2)
- podcasting (8)
- presentation (1)
- programming (31)
- public relations (1)
- public speaking (1)
- questions (1)
- requirements (4)
- search tool (3)
- social media networks (7)
- SQL (9)
- testing (1)
- training (1)
- troubleshooting (7)
- trucking (2)
- twitter (9)
- uml (1)
- VB.NET (2)
- VBA (1)
- wikis (1)
Wednesday, August 22, 2007
Server-side processing rocks the house!
Posted by Daniel at 2:36 PM
Topics: client relations, design, peo, search tool, SQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment