Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Table column storing string greater than 250 characters
Wed, Mar 18 2015 9:50 AMPermanent Link

Brabant Pierrick

How can I create a string column for storing values with length greater than 250 characters ?
Wed, Mar 18 2015 10:06 AMPermanent Link

Matthew Jones

Brabant Pierrick wrote:

> How can I create a string column for storing values with length
> greater than 250 characters ?

You use a blob field.

--

Matthew Jones
Wed, Mar 18 2015 11:01 AMPermanent Link

Jose Eduardo Helminsky

HPro Informatica

Brabant Pierrick

> How can I create a string column for storing values with length
> greater than 250 characters ?

According to DBISAM manual, the capacity for strings is 512 bytes
http://www.elevatesoft.com/manual?action=topics&id=dbisam4&product=rsdelphi&version=XE&section=appendix_system_cap

But if you need more than this Mattew is correct, you must use blob.

Jose Eduardo Helminsky
Wed, Mar 18 2015 11:52 AMPermanent Link

Raul

Team Elevate Team Elevate

On 3/18/2015 9:50 AM, Brabant Pierrick wrote:
> How can I create a string column for storing values with length greater than 250 characters ?
>

Upgrade to DBISAM 4 - DBISAM 3 used 250 as max while DBISAM 4 uses 512.

Otherwise like others have said - use BLOB.

Raul
Wed, Mar 18 2015 1:54 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Brabant


I'll be the first to suggest upgrade to elevatedb where you can have a varchar column of 1024

Roy Lambert
Thu, Mar 19 2015 11:22 AMPermanent Link

Brabant Pierrick

Unfortunately I cannot upgrade do DBISAM4 or ElevateDB.
Can you give me a sample syntax of insert a long string in a BLOB field ?
Thu, Mar 19 2015 12:32 PMPermanent Link

Raul

Team Elevate Team Elevate

On 3/19/2015 11:22 AM, Brabant Pierrick wrote:
> Unfortunately I cannot upgrade do DBISAM4 or ElevateDB.
> Can you give me a sample syntax of insert a long string in a BLOB field ?
>

I don't have v3 available at the moment but in general (below should
work in v4 and i expect also in v3).

Declare you column as ftMemo (in delphi) or Memo in SQL/Dbsys

In delphi you can just use normal .AsString for example to read and
assign values to this  (i.e. DataSet.FieldByName('MyLargeText').AsString
:= 'my string'Wink

In SQL things get little more complicated - you can just use normal SQL
to handle things like updates
i.e. update MyTableset MyLargeText='' where MyLargeText='my string'.


However if you need to display data (espeically in dbsys) then you might
need to cast it into a string which itself is limited again (i.e. select
cast(MyLargeText as char(250)) from mytable).

if you have manageable amount of data you coudl return multiple fields
multiple fields

select CAST(SUBSTRING(MyLargeText FROM 1 FOR 250) as CHAR(200)) as
Text1,CAST(SUBSTRING(memo FROM 251 FOR 250) as CHAR(250)) as Text2 from
MyTable  or even
select CAST(SUBSTRING(MyLargeText FROM 1 FOR 250) as CHAR(200)) +
CAST(SUBSTRING(memo FROM 251 FOR 250) as CHAR(250)) from MyTable

Basically using dataset navigation and update methods is best way to go
here if you have lot of data.

SQL is fine too but you might need to do some casting etc and be careful
using SQL with massive amount of data (i.e. if you load a multi MB file
into a string and then dynamically create a SQL Insert it might not work).

Raul
Fri, Mar 20 2015 3:59 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Raul

>However if you need to display data (espeically in dbsys) then you might
>need to cast it into a string which itself is limited again (i.e. select
>cast(MyLargeText as char(250)) from mytable).

Just to expand further a standard DBGrid will display a memo as (memo) or (MEMO) depending on wether there's anything in it or not.

Memo controls will also accept #13, #10, #9 etc so you need to be careful with those as well.

Roy Lambert
Image