SQL Tips and Tricks


Here are some of the SQL Tips and Tricks articles. If you don't see the answer to your questions about SQL Tips and Tricks, ask us your question and we will get back with you with an answer.

There will be times when 2 people are trying to change the same record at the same time.  For example, a Human Resources Manager might want to change an Employee’s salary and an IT person might want to update the Employee’s password.  This is not an uncommon problem and applications can be written to help avoid this but there is no way it can be prevented 100% of the time.  Therefore, it is a good idea to use the tools provided by SQL to catch this situation and alert the application.  Let’s discuss one concept. Read Full Article

SQL Tips and Tricks


Here are some of the SQL Tips and Tricks articles. If you don't see the answer to your questions about SQL Tips and Tricks, ask us your question and we will get back with you with an answer.

In a recent project, we had to deal with SQL Server transactions that involved multiple timezones and required us to calculate the time employee’s worked across a 24×7 retail chain.  Every time someone clocked-in or clocked-out we recorded the current time so we could later calculate the hours worked.  The problem was that the original developers had used the “DATETIME” field but had placed the default to be “GETDATE()” which uses the current time of the server.  Therefore,  in order to accurately calculate the time difference two times requires complicated daylight savings time lookup tables and more effort in the User Interface.  Here is how we solved it. Read Full Article

SQL Tips and Tricks


Here are some of the SQL Tips and Tricks articles. If you don't see the answer to your questions about SQL Tips and Tricks, ask us your question and we will get back with you with an answer.

While working with SQL Server, I Often find myself needing to just change 1 value in a database record on a production server.  Usually, this happens after working with SQL Query Analzyer to research a problem and then realize that I can’t select the resulting rows below to fix the wrong value.  So how do you do it quickly?  There are a few ways to do this. Read Full Article

SQL Tips and Tricks


Here are some of the SQL Tips and Tricks articles. If you don't see the answer to your questions about SQL Tips and Tricks, ask us your question and we will get back with you with an answer.

A common problem you run across in SQL programming is the need to group a series of records that contain bit fields and you need to determine the appropriate value.  If you were to try it using the MAX/MIN operators to achieve the equivalent AND/OR result of the bit field or even the SUM operator you will get one of the following errors. Read Full Article