Click here to Skip to main content
15,886,919 members
Home / Discussions / Database
   

Database

 
GeneralRe: Help with a SELECT statement required pls. Pin
Michael Potter17-Oct-07 11:40
Michael Potter17-Oct-07 11:40 
GeneralRe: Help with a SELECT statement required pls. Pin
Steven J Jowett17-Oct-07 22:41
Steven J Jowett17-Oct-07 22:41 
QuestionDatatype for NULL Pin
N a v a n e e t h17-Oct-07 2:03
N a v a n e e t h17-Oct-07 2:03 
AnswerRe: Datatype for NULL Pin
Mike Dimmick17-Oct-07 2:22
Mike Dimmick17-Oct-07 2:22 
GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 2:41
N a v a n e e t h17-Oct-07 2:41 
GeneralRe: Datatype for NULL Pin
Colin Angus Mackay17-Oct-07 2:45
Colin Angus Mackay17-Oct-07 2:45 
GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 2:50
N a v a n e e t h17-Oct-07 2:50 
GeneralRe: Datatype for NULL Pin
Mike Dimmick17-Oct-07 6:33
Mike Dimmick17-Oct-07 6:33 
Say that a column is defined as having the smallint datatype. This is a 2-byte integer. The documentation says it can hold values from -32,768 to 32,767. This is the range of a signed 16-bit value. If SQL Server were to hold the NULL as a special value, one value would have to be reserved for that purpose, restricting the range of values you could store.

Instead, each row carries an internal, hidden field called the nullable bitmap. This field is big enough to hold the null value bits for each nullable column in the table, rounded up to a whole number of bytes. If there are 8 or fewer nullable columns, 1 byte will be used, if 9 to 16 nullable columns, 2 bytes, if 17 to 24, 3 bytes, and so on. If the column is set to NULL, SQL Server sets the appropriate bit in the nullable bitmap; if set to an actual value, the corresponding bit is cleared. If this bit is set when reading the record, the value in the field itself is disregarded.

The full details of how SQL Server actually stores data can be found in "Inside SQL Server" by Kalen Delaney (for 2005, "Inside SQL Server 2005: The Storage Engine").

Personally I prefer to avoid NULLs where possible. It can get very confusing differentiating NULLs that are the actual column (non-)value and those that arise from outer joins where no match was found.


DoEvents: Generating unexpected recursion since 1991

GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 18:26
N a v a n e e t h17-Oct-07 18:26 
AnswerRe: Datatype for NULL Pin
Pete O'Hanlon17-Oct-07 2:26
mvePete O'Hanlon17-Oct-07 2:26 
GeneralRe: Datatype for NULL Pin
N a v a n e e t h17-Oct-07 2:39
N a v a n e e t h17-Oct-07 2:39 
GeneralRe: Datatype for NULL Pin
Pete O'Hanlon17-Oct-07 2:56
mvePete O'Hanlon17-Oct-07 2:56 
QuestionMDX + Trasnsactional Level Pin
GChannon17-Oct-07 2:00
GChannon17-Oct-07 2:00 
QuestionForce DTS Failure Pin
Bjohnson3317-Oct-07 0:33
Bjohnson3317-Oct-07 0:33 
AnswerRe: Force DTS Failure Pin
andyharman17-Oct-07 1:53
professionalandyharman17-Oct-07 1:53 
GeneralRe: Force DTS Failure Pin
Bjohnson3317-Oct-07 2:57
Bjohnson3317-Oct-07 2:57 
QuestionCreate Function Pin
Sarfaraj Ahmed16-Oct-07 23:34
Sarfaraj Ahmed16-Oct-07 23:34 
AnswerRe: Create Function Pin
Hesham Amin17-Oct-07 0:34
Hesham Amin17-Oct-07 0:34 
GeneralRe: Create Function Pin
Sarfaraj Ahmed17-Oct-07 1:54
Sarfaraj Ahmed17-Oct-07 1:54 
GeneralRe: Create Function Pin
Sarfaraj Ahmed17-Oct-07 2:14
Sarfaraj Ahmed17-Oct-07 2:14 
Questiondatatype mismatch Pin
sean0016-Oct-07 19:00
sean0016-Oct-07 19:00 
AnswerRe: datatype mismatch Pin
Giorgi Dalakishvili16-Oct-07 20:47
mentorGiorgi Dalakishvili16-Oct-07 20:47 
GeneralRe: datatype mismatch Pin
sean0017-Oct-07 5:40
sean0017-Oct-07 5:40 
GeneralRe: datatype mismatch Pin
Giorgi Dalakishvili17-Oct-07 6:00
mentorGiorgi Dalakishvili17-Oct-07 6:00 
AnswerRe: datatype mismatch Pin
pmarfleet16-Oct-07 20:51
pmarfleet16-Oct-07 20:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.