Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Will empty string take up more space?
Message
From
22/10/2004 07:08:09
Km Kwun
Eastop Consultants Limited
Nt, Hong Kong
 
 
To
22/10/2004 06:35:17
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00953619
Message ID:
00953668
Views:
14
Hi Fabio,

How about SQL Server? Will defaulting a TEXT field to an empty string (real value) take up more or less space than defaulting it to Null (no value) in SQL Server.


Ben



>If you have one or more field nullable, VFP add hidden field (1 byte lenght) to the record structure.
>Then use null use one byte ( space is very small ) and one field ( this is more restrictive ).
>
>But, you don't hesitate: use NULL, any other choice it is mistaken.
>
>A little ex.:
>
>CLEAR
>CREATE CURSOR C1 (F1 i NOT null,f2 m NOT NULL)
>FOR K=1 TO 10000
>APPEND BLANK
>NEXT
>? RECSIZE(),HEADER()+RECCOUNT()*RECSIZE()
>
>CREATE CURSOR C1 (F1 i null,f2 m NOT NULL)
>FOR K=1 TO 10000
>APPEND BLANK
>NEXT
>? RECSIZE(),HEADER()+RECCOUNT()*RECSIZE()
>
>CREATE CURSOR C1 (F1 i null,f2 m NULL)
>FOR K=1 TO 10000
>APPEND BLANK
>NEXT
>? RECSIZE(),HEADER()+RECCOUNT()*RECSIZE()
>
>CREATE CURSOR C1 (F1 i null,f2 m NULL DEFAULT NULL)
>FOR K=1 TO 10000
>APPEND BLANK
>NEXT
>? RECSIZE(),HEADER()+RECCOUNT()*RECSIZE()
>
>CREATE CURSOR C1 (F1 i NULL  DEFAULT NULL,f2 m NULL DEFAULT NULL)
>FOR K=1 TO 10000
>APPEND BLANK
>NEXT
>? RECSIZE(),HEADER()+RECCOUNT()*RECSIZE()
>
>
>>My app will connect to either a VFP database or a SQL server (switchable by changing an INI file). I have set the TEXT field in SQL, mapping to a MEMO field in VFP, "not nullable" and default to an empty string. I think this is a better choice over setting the TEXT field nullable and default to NULL since code for both VFP and SQL backend will be easier to be kept the same.
>>
>>What I understand is a TEXT field is a pointer to actual information. May question is will defaulting a TEXT field to an empty string (real value) take up more space than defaulting it to Null (no value).
>>
>>TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform