Boring SQL question for those in the know.

I use SQL all the time, but my formal education in it is spotty and my memory is worse. Someone asked me a question the other day and I couldn’t answer it:

What does the field length “16” mean for a “Text” field? It certainly isn’t characters.
See, I told you it was boring.

In most SQL implementations I have worked with, it should be length in bytes. If you are using ascii, that will also be the number of characters (8bits=1byte, ascii uses 8bits per character) Unicode may change that, however.

A Text field is, in reality, not a text field at all. A text field is simply a pointer to the location of a Binary Large OBject (BLOB). A text field is usually used for text that is larger than 8000 characters.

Zev Steinhardt

… and 16 bytes is the length of the pointer.

Zev Steinhardt

Which DBMS?

As I recall, “text” is not an ANSI datatype, but rather a vendor extension.

In Sybase, MySQL, Postgres, and MS SQL Server, it’s a blob

In MS Access, a text column is the equivalent of VARCHAR

I don’t think Oracle has a “text” type

Nope … it’s called CHAR or VARCHAR2 in Oracle.

Sixteen bytes is the length of a pointer? What sort of address space are you using? Maybe you mean 16 bits.

Zev is a very profound man, he needs big text fields. :smiley:

Scupper, I think more info is needed. I’m an Oracle maven and as others have said it doesn’t have a TEXT datatype. CHAR is a fixed length text field, varchar2 is a variable length text field up to a specified size (in the low thousands, depending on what version) and LONG which is a text field of unlimited length. LONG is text, not binary (a BLOB) object as that is called a RAW or LONG RAW depending on size.