Datasheet
over the prior year, but you don’t have records for the year before the first record in your database. You
might be tempted to just enter a zero in the
PercentGrowth column. Would that provide the right infor-
mation though? People who didn’t know better might think that meant you had zero percent growth,
when the fact is that you simply don’t know the value for that year.
Values that are indeterminate are said to be
NULL. It seems that every time I teach a class in programming,
at least one student asks me to define the value of
NULL. Well, that’s a tough one, because, by definition, a
NULL value means that you don’t know what the value is. It could be 1; it could be 347; it could be –294 for
all we know. In short, it means
undefined or perhaps not applicable.
SQL Server Identifiers for Objects
Now you’ve heard all sorts of things about objects in SQL Server. But let’s take a closer look at naming
objects in SQL Server.
What Gets Named?
Basically, everything has a name in SQL Server. Here’s a partial list:
Stored procedures Tables Columns
Views Rules Constraints
Defaults Indexes Filegroups
Triggers Databases Servers
User-defined functions Logins Roles
Full-text catalogs Files User-defined types
Schemas
And the list goes on. Most things I can think of except rows (which aren’t really objects) have a name.
The trick is to make every name both useful and practical.
Rules for Naming
The rules for naming in SQL Server are fairly relaxed, allowing things like embedded spaces and even
keywords in names. Like most freedoms, however, it’s easy to make some bad choices and get yourself
into trouble.
Here are the main rules:
❑ The name of your object must start with any letter as defined by the specification for Unicode
2.0. This includes the letters most westerners are used to— A–Z and a–z. Whether “A” is differ-
ent from “a” depends on the way your server is configured, but either makes for a valid begin-
ning to an object name. After that first letter, you’re pretty much free to run wild; almost any
character will do.
15
Being Objective: Re-Examining Objects in SQL Server
04_584340 ch01.qxp 10/18/06 2:11 PM Page 15