This is the last of the lessons on functions for the 100 level. I hope you’ve enjoyed them so far, but it’s time to wrap these up! When beginning to learn SQL, it won’t be long until you have to answer questions that require you to summarize the data. It’s one of the primary reasons…
Tag: T-SQL
SQL 101 – System Functions
There are many functions built in to SQL 2000. I’m not going to cover them all, since many of them you won’t have a need for until you really dig in deep with SQL programming. But there are seven you should really be familiar with. CASE You have no idea how much you’ll use the…
SQL 101 – Date Manipulation Functions
Welcome back! This post is a followup to the post about string functions. The difference is this time, we’re discussing functions that manipulate dates. GETDATE The most often used function I can think of, with the possible exception of COUNT(*) is GETDATE(). When called this gives you the current datestamp from the server. This gives…
SQL 201 – String Manipulation Functions
In a previous post I introduced you to calculated fields, and mentioned there were many other functions you could use to compute values or columns. It’s time to introduce you to the eight most used functions when it comes to manipulating strings in SQL LEFT and RIGHT If you ever need the first 3 or…
SQL 101 – Calculated Fields
When working with SQL you will inevitably be asked to return data from your database in a way it’s not stored. You’ll be asked to return city, state and zip as a single string, yet they are stored separately. You’ll be asked to return grand totals, but you only have line item totals. You’ll be…
SQL 101 – The Advanced LIKE Clauses
As I promised, this is my post on advanced LIKE clauses. Previously I’ve only shown you how to do a wildcard search that would act like the dos command “dir A*.*”, returning all the files that start with the letter A. But there is far more you can do with the LIKE operator. Wildcards themselves…
SQL 101 – SELECT, Filtering Results (Part 2)
In the previous post, I covered the WHERE clause. You should now feel pretty comfortable limiting the number of rows you get to return based on the values in a column. But I’m sure you’ve already asked “How can I limit based on two different columns?” I’m glad you asked! You can chain together your…
SQL 101 – SELECT, Filtering Results
After you learn how to get data out of a table with the SELECT command, you’ll soon ask the question, how do I limit the number of results I get back. Well, If you don’t ask the question, your DBA will. I don’t think he or she would like it if you only ever used…
SQL 101 – SELECT
The first thing you need to know when learning SQL is how to get data out of a database. This means learning the SELECT command. Using this command will get the SQL server to return data to you. You can use this command to do some simple math, or to do the common “Hello World!”…
Quickly Disconnect Users From a Database
Disconnect All Users of a Database There comes a time in every DBA’s life when he or she has many users connected to a database that needs to be detached, placed in single user mode, or simply refreshed. The problem is they keep reconnecting more quickly than you can KILL them off. This is especially…