Monthly Archives: September 2011

Live Blogging – SMB Nation 2011

SMB Nation has gotten off to a great start at 7:00 local time here in Las Vegas. It is early, but there is a lot of excitement.

I’m currently watching the main keynote with Cisco, which is making a big push into the small and medium business space. Since SMB’s drive the economy, this is great news.

Some of the points being made are that they need technology to stay competitive, are shifting to the cloud for efficiency and reliability and are shifting away from a full time IT staff.

At RiteTech, we’ve been working with Cisco for over a year by testing some of their new devices and services.

We also urge our clients migrate to the cloud and consider ourselves your “outsourced” IT department, so we are right on track.

I look forward to the rest of the conference!

Advertisements

Cisco Features RiteTech and Dave Bainum in Video

Back in July the RiteTech office was busy preparing for our big screen debut.  We cleaned the office, painted the walls and wrapped the vehicles!  All our efforts paid off, for the video is great!  Check it out:  http://www.cisco.com/web/partners/sell/smb/onplus/grow_my_business.html.

For over a year, RiteTech has been working with Cisco to perfect their OnPlus network device and service.  This device allows us to better monitor our client’s locations and network.  We know within minutes if a network goes down – invaluable information in our line of work.

Variable Placement in SQL Queries

When I’m creating complicating queries, I tend to build the query in SQL Query Analyzer before copying the code into my ColdFusion page. Other times I will copy the ColdFusion debugging code into Query Analyzer with the variable values to recreate a result set. Either way, handing variables can be tricky. I either have a hard time locating the variables to put in static values, or forget to remove static values and put back in the variable place holder before pasting back into CF. Anyone else do this?

To make my life easier, I’ve starting declaring all of my SQL variables at the top of the query. This has several benefits:

1. I can easily see all the variables and their data types at the top of the query
2. I don’t have to hunt around to find/replace values
3. I only need to pass in the same variable value once

Here’s an example of a query in Query Analyzer:

DECLARE @startDt DATETIME
, @endDt DATETIME

SET @startDt = '1/1/2004'
SET @endDt = '1/31/2004'

SELECT *
FROM SalesOrder SO
INNER JOIN SalesOrderDetail SOD ON SO.SalesOrderID = SOD.SalesOrderID
WHERE 1 = 1
AND (
@startDt IS NULL
OR SO.SalesOrderDt >= @startDt
)
AND (
@endDt IS NULL
OR SO.SalesOrderDt <= @endDt
)

For testing purposes, I’m getting all sales in January 2004 (Sorry, my test DB has OLD data). When I past this into CF, I only need to change two lines:

SET @startDt = <cfqueryparam cfsqltype="cf_sql_date" value="#startDt#"
null="#IIf(IsDate(startDt), DE("no"), DE("yes"))#" />
SET @endDt = <cfqueryparam cfsqltype="cf_sql_date" value="#startDt#"
null="#IIf(IsDate(startDt), DE("no"), DE("yes"))#" />

If either value is empty, a NULL value will be passed into the query and the WHERE clause will properly handle that value.

While it does create more code, it is a much more elegant – and stress free – way to design a query.

%d bloggers like this: