[firebird-support] split a string inside a stored proc or trigger

2011-08-23 Thread Sergio H. Gonzalez
Hello, I'm using FB 2.5. Having a string like "10 -20 10.2" it is possible to get 3 numeric values = 10, -20 and 10.2? That numbers are % to be applied to a currency field MY_CURR_FIELD + 10% - 20% + 10.2% ...meanwhile I'm trying to write a UDF, but I have none experience in doing that...

[firebird-support] delete from table... best way?

2011-09-15 Thread Sergio H. Gonzalez
[FB 2.5] Hello there! a have a very common situation... a table (T1) which is joined to T2... I want to delete all records from T1 that has a null description in T2 this works fine: delete from t1 where (select t2.descripcion from t2 where (t1.id_t2 = t2.id)) is null but I wander if there is

[firebird-support] selecting a field by name (using a var)

2011-11-07 Thread Sergio H. Gonzalez
Hello! I use FB2.5. It is possible to have an SP in which I send a string as input paramemeter and I get the value of some field named as my input parameter? CREATE PROCEDURE PANIO_TERMINADO ( in_id fk_id, in_etapa codigo) returns ( out_fecha fecha_hora) as begin select /* (in_

[firebird-support] Re: selecting a field by name (using a var)

2011-11-09 Thread Sergio H. Gonzalez
Hi Karol! Sorry bat I don't know how to do it with a normal select... how would it be? -s [Non-text portions of this message have been removed]

[firebird-support] Copy a database to a blank one

2011-12-14 Thread Sergio H. Gonzalez
Hello! I'm using FB2.5. Is there any command line to copy a database to a blank one? I mean, I need to create an empty copy of a given database, but I'd like to do it using a command in a bath file... I hope I'm clear! I'v been googling but had no luck!. -sergio [Non-text portions of this mess

[firebird-support] selecting concatenated records

2012-01-16 Thread Sergio H. Gonzalez
hello!! I have this situation, and don't know how to solve it... My table: ID ORIGINAL_ID 1NULL 21 32 4NULL 51 So, the ID 1 has two children (2 and 5) and 2 has one children (3). Of course, ID 3 could have N children and so on.

[firebird-support] using a param on a join part of a query

2012-01-25 Thread Sergio H. Gonzalez
Hello! This may be a silly question, but just in case I ask it anyway... Is there any problem in doing something like this? select d.descripcion, d.cantidad, p.id as id_plan_ctas, p.descripcion as desc_plan_ctas from fac_ven_detalle d left join cont_plan p on ((d.plan_ct

[firebird-support] last record from a table

2012-01-27 Thread Sergio H. Gonzalez
(Firebird 2.5) Hello! this is probably an old question, but didn't find nothing on the net... Here's a sample table: MyTable (has two fields) = ID: integer & MyDate: Date Is this the best (fastest) way to get the LAST inserted record from a table? select MyDate from MyTable where id = (select

[firebird-support] gbak connection string

2012-01-30 Thread Sergio H. Gonzalez
(FB 2.5) Hello! is there any problem in using gbak with this string: gbak c:\myfolder\mydatabse.fdb [etc...] while there are other PCs connected to the same databse with tcp/ip: servername:c:\myfolder\mydatabse.fdb ??? If I remember well, mixing string connections could damage the database? I

[firebird-support] selecting between dates with timestamps fields

2012-02-03 Thread Sergio H. Gonzalez
Hello! I have a timestamp field with an index how can I select the fields from a given date, but using the index? If I do: where ((cast (MyTimeStamp as date)) between :from_date and :to_date) I guess that is better not to do the cast and pass the params with date + time. I use Delphi and

[firebird-support] not null and index usage

2012-02-13 Thread Sergio H. Gonzalez
Hello! Having this simple query: (and "some_id" being a foreing key) select * from my_table where (some_id is null) uses the index... but select * from my_table where (some_id is not null) doesn't uses it. Now the table is quite small, so I have no performance issues, but can I do something f

[firebird-support] setting a generator inside a SP

2012-02-17 Thread Sergio H. Gonzalez
Hello! In the FB guide reads: "Setting a generator directly to a certain value (“Update”) PSQL GEN_ID(, - GEN_ID(, 0 ) ); Warning This is more of a dirty little trick to do what you normally cannot and should not do in SPs and triggers: /setting/ gener

[firebird-support] database in external USB HDD

2012-07-02 Thread Sergio H. Gonzalez
Hello there! I use FB 2.5. Is there any known problem with having the database file in an external USB drive conected to the server? Just in case (don't know if it matters!) I always use superserver mode. thanks!! -sergio [Non-text portions of this message have been removed]

[firebird-support] UDF 64 bits

2012-12-04 Thread Sergio H. Gonzalez
Hello... I think I've posted this question before, but now can't find the thread... Anyway I still have the problem... An UDF that worked fine in FB 32 bits, in 64 bits doesn't work This is the DDL: DECLARE EXTERNAL FUNCTION SG_DES DOUBLE PRECISION, CSTRING(50) RETURNS DOUBLE PRECISIO

[firebird-support] "best way" of doing a very simple thing (or is "expensive" having fields with nulls?)

2013-11-18 Thread Sergio H. Gonzalez
(FB2.5) Hello! I have a simple table like this CREATE TABLE INVOICES_DETAIL ( IDID, ID_STOCK FK_ID, QTY INTEGER, PRICE MONEY, DEFAULT_PRICE MONEY ); Most of the times, (lets say 90%) the default_