Subject RE: [firebird-support] Easy Question SQL
Author Thomas Steinmaurer
Thomas,

> I have a database with one table, one field. Field is a varchar 255.
>
> I now want every entry with a length over 250, but:
>
> Select * from tablename where length(feld2) > 250
>
> isn't working.
>
> Same with:
>
> Select * from tablename where character_length(feld2) > 250
>
> So,
>
> how can i get with a sql every entry with more then 250 characters....
>
> Thanks a lot and
>
> cu

You have to use the strlen function in the ib_udf library.
Make sure that ib_udf.dll (or ib_udf.so for Linux) is located
in the udf subdirectory.

Connect to your database and execute the following DECLARE
EXTERNAL FUNCTION statement (all function declarations can
be found in a file called ib_udf.sql).

DECLARE EXTERNAL FUNCTION strlen
CSTRING(32767)
RETURNS INTEGER BY VALUE
ENTRY_POINT 'IB_UDF_strlen' MODULE_NAME 'ib_udf';

Now, try to use the function with e.g.

select * from tablename where strlen(feld2) > 250;


HTH,
Thomas Steinmaurer

The IB LogManager Product Family
Logging/Auditing Suite for InterBase and Firebird
http://www.iblogmanager.com