[firebird-support] IN using a string from another table field

2012-04-12 Thread venussoftop
Hi all I have tried the following query SELECT tSaleInvoice.* FROM tSaleInvoice WHERE tSaleInvoice.iID IN (SELECT tSaleInvoiceCvrLtr.cSaleInvIDs FROM tSaleInvoiceCvrLtr WHERE tSaleInvoiceCvrLtr.iID = 993) The idea is to pull out records from tSaleInvoice on it's PK i

[firebird-support] Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
Hi all Can I use a CASE WHEN in the WHERE for a statement as below? The idea was to either pull out records from the tSaleInvoice based on a list of PKs in a separate table.field (see my other IN post) if the value is not present then on the same records date and iBuyerID. SELECT tSalein

Re: [firebird-support] Is such a CASE WHEN usage allowed?

2012-04-12 Thread Mark Rotteveel
On Thu, 12 Apr 2012 07:25:26 -, "venussoftop" wrote: > Hi all > > Can I use a CASE WHEN in the WHERE for a statement as below? The idea was > to either pull out records from the tSaleInvoice based on a list of PKs in > a separate table.field (see my other IN post) if the value is not >

Re: [firebird-support] IN using a string from another table field

2012-04-12 Thread Mark Rotteveel
On Thu, 12 Apr 2012 07:15:22 -, "venussoftop" wrote: > Hi all > > I have tried the following query > SELECT tSaleInvoice.* >FROM tSaleInvoice >WHERE tSaleInvoice.iID IN > (SELECT tSaleInvoiceCvrLtr.cSaleInvIDs > FROM tSaleInvoiceCvrLtr > WHERE tSaleInvoiceCvrLt

[firebird-support] ODBC driver connect to FB 2.0 but not FB2.5

2012-04-12 Thread kokok_kokok
I am running with 2 Firebirds, FB 2.0 in the 3050 port and FB2.5 in the 3051 port. When I create a ODBC connection, in the database path of the ODBC 2.0 driver I use: MYSERVER/3050:D:\DataBases\MyDatabase.fdb It works fine and it connects to FB 2.0 When I use MYSERVER/3051:D:\DataBases\MyDatab

[firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, Mark Rotteveel wrote: > > On Thu, 12 Apr 2012 07:25:26 -, "venussoftop" > wrote: > > Hi all > > > > Can I use a CASE WHEN in the WHERE for a statement as below? The idea > was > > to either pull out records from the tSaleInvoice based on a list of

[firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, "venussoftop" wrote: > > > > --- In firebird-support@yahoogroups.com, Mark Rotteveel wrote: > > > > On Thu, 12 Apr 2012 07:25:26 -, "venussoftop" > > wrote: > > > Hi all > > > > > > Can I use a CASE WHEN in the WHERE for a statement as below? Th

Re: [firebird-support] IN using a string from another table field

2012-04-12 Thread Norman Dunbar
Morning, On 12/04/12 08:15, venussoftop wrote: > Hi all > > I have tried the following query > SELECT tSaleInvoice.* > FROM tSaleInvoice > WHERE tSaleInvoice.iID IN >(SELECT tSaleInvoiceCvrLtr.cSaleInvIDs > FROM tSaleInvoiceCvrLtr > WHERE tSaleInvoiceCvrLtr.iID

[firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, "venussoftop" wrote: > > > > --- In firebird-support@yahoogroups.com, "venussoftop" wrote: > > > > > > > > --- In firebird-support@yahoogroups.com, Mark Rotteveel wrote: > > > > > > On Thu, 12 Apr 2012 07:25:26 -, "venussoftop" > > > wrote: > >

Re: [firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread Mark Rotteveel
On Thu, 12 Apr 2012 07:52:34 -, "venussoftop" wrote: > Thanks Mark. I worked on it as per your suggestion and I have the > following now (I have replaced all variables with literals) > SELECT tSaleinvoice.* >FROM tSaleInvoice >WHERE tSaleInvoice.iID IN (CASE WHEN COALESCE('24315,24371

Re: [firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread Mark Rotteveel
On Thu, 12 Apr 2012 07:55:32 -, "venussoftop" wrote: > Okay okay I used the LIST() function, the error is gone but I do not get > any results returned > SELECT tSaleinvoice.* >FROM tSaleInvoice >WHERE tSaleInvoice.iID IN (CASE WHEN COALESCE('24315,24371', '') = '' >THEN ((SELECT c

Re: [firebird-support] Is such a CASE WHEN usage allowed?

2012-04-12 Thread Arno Brinkman
Hi, What about: SELECT tSaleinvoice.* FROM tSaleInvoice WHERE EXISTS(SELECT * FROM tSaleInvoiceCvrLtr WHERE tSaleInvoice.iID = tSaleInvoiceCvrLtr.cSaleInvIDs and tSaleInvoiceCvrLtr.iID = :vp_iID) or (iBuyerID = :iBuyerID AND tSaleInvoice.tDt = :tDt) Regards, Arno Brinkman

[firebird-support] Connecting to Firebird database using Embedded server

2012-04-12 Thread crizaldogordo
Hello guys, I developed application from Visual Basic 6 and created a database from firebird 1.5, I have installed embedded server 1.5,but i don't know how to create a connection string to connect to my database. I was able to make it using the DSN connection. but i dont want to use DSN connecti

[firebird-support] Re: Connection String question - vb.net - embedded

2012-04-12 Thread crizaldogordo
I've same problem with you,but got the solution, use DSN connection and use the embed.dll as the "CLIENT" in configuring the ODBC connection. --- In firebird-support@yahoogroups.com, "rickgeorge88" wrote: > > Hello, > > I have tried various ways of connecting (Google) to an embedded firebird

[firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, Mark Rotteveel wrote: > > On Thu, 12 Apr 2012 07:52:34 -, "venussoftop" > wrote: > > Thanks Mark. I worked on it as per your suggestion and I have the > > following now (I have replaced all variables with literals) > > SELECT tSaleinvoice.* > >F

[firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, Mark Rotteveel wrote: > > On Thu, 12 Apr 2012 07:55:32 -, "venussoftop" > wrote: > > > Okay okay I used the LIST() function, the error is gone but I do not get > > any results returned > > SELECT tSaleinvoice.* > >FROM tSaleInvoice > >WHERE

Re: [firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread Mark Rotteveel
On Thu, 12 Apr 2012 09:16:06 -, "venussoftop" wrote: > Thanks Mark and sorry about the logical error, here is the correction > SELECT tSaleinvoice.* >FROM tSaleInvoice >WHERE tSaleInvoice.iID IN (CASE WHEN COALESCE('24315,24371', '') = '' > THEN ((SELECT LIST(tSI.iID) FROM tSaleI

Re: [firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread Mark Rotteveel
On Thu, 12 Apr 2012 09:28:48 -, "venussoftop" wrote: > Thanks Mark I see the point now. Is there a function to convert the > string as returned by LIST() or in my field, because both are strings, one > automatically created and another manually created > '24315,24371' > to > 24315,24371 No t

[firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, Mark Rotteveel wrote: > Here I do assume that cSaleInvIDs contains a single value, not a string of > comma-separated values. > Mark, actually cSaleInvIDs is a comma separated list of integers as a string I believe the same as what LIST() would return.

Re: [firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread Kjell Rilbe
venussoftop skriver: > > Thanks Mark and sorry about the logical error, here is the correction > SELECT tSaleinvoice.* > FROM tSaleInvoice > WHERE tSaleInvoice.iID IN (CASE WHEN COALESCE('24315,24371', '') = '' > THEN ((SELECT LIST(tSI.iID) FROM tSaleInvoice tSI WHERE tSI.iBuyerID = > 1583 AND CAS

[firebird-support] Re: IN using a string from another table field

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, Mark Rotteveel wrote: > No you can't. Now you have an IN list with a single value, and Firebird > attempts to convert that string value to INTEGER for comparison with iID, > this fails. You can only use IN list with explicit values list, not a > 'list' in

Re: [SPAM 4] [firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread Kjell Rilbe
venussoftop skriver: > > Now I can I be able to do a IN against an integer iID? If not is there > any way to convert the comma separated string to comma separated > integer value? > With a stored proc, yes, as suggested by Mark, but as I wrote far down in my other post, you can do this: POSITI

[firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, Mark Rotteveel wrote: > No there isn't. You could write a stored procedure that splits the string > and returns the values as individual rows. Better would be to not store it > like that at all as Arno indicated. > Thanks Mark.

[firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, "Arno Brinkman" wrote: > > Hi, > > What about: > > SELECT > tSaleinvoice.* > FROM > tSaleInvoice > WHERE > EXISTS(SELECT * FROM tSaleInvoiceCvrLtr WHERE tSaleInvoice.iID = > tSaleInvoiceCvrLtr.cSaleInvIDs and tSaleInvoiceCvrLtr.iID = :vp_iID) or

[firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread Svein Erling Tysvær
> POSITION(sep || soughtval || sep in sep || searchedvaluelist || sep) > 0 > > Adding sep before and after each string makes sure you don't get false hits, > like '12' > in '341256,234,567' where '12' appears inside '341256', but ',12,' doesn't. Good idea, Kjell, but then why not use CONTAINING

Re: [firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread Kjell Rilbe
Svein Erling Tysvær skriver: > > > POSITION(sep || soughtval || sep in sep || searchedvaluelist || sep) > 0 > > > > Adding sep before and after each string makes sure you don't get > false hits, like '12' > > in '341256,234,567' where '12' appears inside '341256', but ',12,' > doesn't. > > Good i

[firebird-support] Re: IN using a string from another table field

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, Norman Dunbar wrote: > Convert your id to a string with leading and trailing commas. > Retrieve the rows required (where tSaleInvoiceCvrLtr.iID = 993). > For each row, wrap the list of ids in a leading and trailing comma. > Check if your string ",id," is

[firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, Svein Erling Tysvær wrote: > > > POSITION(sep || soughtval || sep in sep || searchedvaluelist || sep) > 0 > > > > Adding sep before and after each string makes sure you don't get false > > hits, like '12' > > in '341256,234,567' where '12' appears insi

[SPAM 4] [firebird-support] Re: Is such a CASE WHEN usage allowed?

2012-04-12 Thread venussoftop
--- In firebird-support@yahoogroups.com, Kjell Rilbe wrote: > > venussoftop skriver: > > > > Now I can I be able to do a IN against an integer iID? If not is there > > any way to convert the comma separated string to comma separated > > integer value? > > > > With a stored proc, yes, as sugge

[firebird-support] Question about user rights and procedures

2012-04-12 Thread Josef Kokeš
Hi! I feel a bit overwhelmed by user rights in a database in respect to stored procedures. I have a database owned by user OWNER. I want to give limited access to user ATTACKER, so that he can read and write the database through a stored procedure MODIFY_DATABASE. So I grant: GRANT EXECUTE ON

[firebird-support] Latest entries on either Date or Batch No. field

2012-04-12 Thread venussoftop
Hi all I have Parent-Child tables that contain Price List and are updated with the same items in them but with either a later date or a later batch no. filled in, so typical child records would be as follows iID, iItemID, bRate, dDt, iBatchNo 1, 123, 50.00, empty, 156 2, 123, 55.00, empty, 160

[firebird-support] Restore problem

2012-04-12 Thread Aage Johansen
Fb/2.5 restoring Fb/1.5 database with (one single command line): == gbak -se service_mgr -fix_fss_metadata ISO8859_1 -fix_fss_data ISO8859_1 -rep -v -z -user SYSDBA -password masterkey E:\...\...\sl1b3_20120412.fbk15 SL1 ===

Re: [firebird-support] Re: No index used for join on 'starting with'

2012-04-12 Thread Michael Ludwig
unordained schrieb am 11.04.2012 um 15:18 (-0500): > I once worked on medical software (with Firebird!) and we had to > deal with ICD-9 and CPT-4 codes. The coding mechanism is somewhat > hierarchical: code 201 might mean something, and 201.1 might be > more specific, and 201.12 might be even *mor

Re: [firebird-support] Restore problem

2012-04-12 Thread Dmitry Kuzmenko
Hello, Aage! Friday, April 13, 2012, 1:44:34 AM, you wrote: AJ> Fb/2.5 restoring Fb/1.5 database with (one single command line): AJ> == AJ> gbak -se service_mgr AJ>-fix_fss_metadata ISO8859_1 AJ>-fix_fss_data ISO8859_1 AJ>-rep -v -z AJ>