Re: size of ftInteger



I did some more investigating. I did the following:

var
xy:integer;
begin
xy := 999999999;
showmessage(inttostr(sizeof(xy)));

I also tried it for xy:=0

The result is always 4. I had a funny feelling that would be the case. But
now I'm more puzzled. When setting up an integer field in a MS SQL table,
the precision is 10, the scale is 0 and the length is 4. What is the
CreateParameter's "size" parameter looking for. This is a bit confusing. I
went on line and did a google search for "CreateParameter" and "ftInteger"
together. It seems that everyone uses something different almost as if
nobody really knows what to use.

According to the help file:

function CreateParameter(const Name: WideString; DataType: TDataType;
Direction: TParameterDirection; Size: Integer
; Value: OleVariant): TParameter;

In addition, I tried the above test using xy as datatype Single, Double and
Currency. The size came out 4, 8 & 8 respectively. I guess this was no
surprise either because those are the "lengths" as far as MS SQL is
concerned.

Perhaps that parameter should be called "Length" rather than size as this
seems to be a bit misleading. Hopefully someone can clear this up for me.

Keith


.



Relevant Pages

  • Re: SQL performance - multiple rows for SELECT (SQL0811)
    ... straightforward with SQL. ... SELECT aaa into:var from filea ... UPDATE fileb set xxx = 123 ... some high-volume batch jobs that have lots of embedded ...
    (comp.sys.ibm.as400.misc)
  • Re: PHP page get executed twice
    ... $RESULTcheck = mssql_query; ... let's write data to database ... var $name; # columnname ... # class sql ...
    (comp.lang.php)
  • Re: Null in SQL 2005/2008
    ... Starting in SQL 7, ... field, a long integer field, an integer field, a Varcharfield and this ... plus overhead ... You can choose to store the data in compressed format, which will take a lot fewer bytes (storage is much too complex to describe here), OR define your nullable columns as SPARSE, in which case there will be just 4 bits of overhead for each null value. ...
    (microsoft.public.sqlserver.server)
  • Re: Question about extending CRC32 to CRC64
    ... > whole SQL into file. ... CRCxx is used to find the file by name. ... > SQL string so I belive you can use it with no fear. ...
    (borland.public.delphi.language.basm)
  • Re: Seeking by index of nvarchar field does not works
    ... one of the fields is an integer field. ... Note saying that is necessary ... I have simple SQL Mobile database with one table. ... When I try to execute this program on Pocket PC 2003 SE ...
    (microsoft.public.sqlserver.ce)