Thursday, July 14, 2005


NULL is not nothing

There is a big difference between NULL and nothing. I will demonstrate one notable difference with a simple example.

First, create a table that allows NULLs and has a default value

create table test_table (col_a int default 0 null, col_b int null)

Now let's try inserting these rows:

1. A row where we assign neither value:

insert into test_table values ()

select * from test_table

col_a col_b
----------- -----------

Note: col_a got the default value, and col_b got NULL.
NULL is like the default value you get when you don't assign a default value to a column. Creating the column like this would be redundant: ... col_b int default null null)

2. A row where we assign NULL values:

insert into test_table (col_a, col_b) values (NULL, NULL)

select * from test_table

col_a col_b
----------- -----------

Note: Here, col_a got NULL. It did not use the default value.
Because a value was provided: NULL. NULL is a value.

Related Link: Earlier I wrote a blog about NULLs in Sybase:

Thursday, July 07, 2005


Sybase Survival Pack

There are a lot of great resources on Sybase, and you can see some of them among my links. But there are some utilities/documents that are so valuable that I burn them on a CD and carry a copy with me.


I have nothing against isql. But SQSH (SQL-Shell, developed by Scott Gray) allows you to edit previous statements (even far back in your history), use variables, among many other things. It's hard to use ISQL when I could be using SQSH.

2. Sybooks

Obviously I need the ultimate reference. Sybooks is the quickest and easiest way to look up error messages and commands. I always install my own copy so I don't have to rely on Internet access.

3. SybPerl

For advanced database work, it is handy to use Perl to write scripts. Because it is quick and easy to write, and can be used on every O/S. SybPerl is a set of libraries, developed by Michael Peppler, of the most common tasks.

4. Sybase Product Manuals

These are more than references (which you use Sybooks for anyway). You want the following (at least):
- The Quick Reference Guide
- The System Tables Diagram
- The Glossary (trust me!)
- The Performance and Tuning Guide
- The Reference Manuals (all 4, including building blocks, commands, procedures and tables)
- System Administration Guide
- Transact-SQL User's Guide
- Troubleshooting and Error Messages Guide
- Utility Guide

5. Various Utility Procs

Everyone has their own collection of handy utilities, procedures and scripts. If you don't, you can start building your library based on those of others. I heartily recommend starting with Ed Barlow and Todd Boss and take it from there. You'll keep most of your library on a memory stick because you'll be constantly tweaking them, but your core procedures belong on the disk.

I'm interested in hearing what you felt I may have left out. Please leave comments!

This page is powered by Blogger. Isn't yours?