Re: [firebird-support] Copy Table

2014-04-04 Thread atunccekic
Thank you Thomas Sometimes I may add fields to the master table and if I write all the fields explicitely, I will need to modify the stored procedure. I want to ensure to make an exact copy. So what I want to is: 1- Get the structure of the master table 2- Create a table with the year-month-

[firebird-support] Reading unnecessary records

2014-04-04 Thread kokok_kokok
I use the latest version of FB 2.5. There is a view for called PERSON. Each row represents a person and it shows information as address, name, hobbies, etc. There are 20 joined codification tables using LEFT JOIN. For example all cities are codified, hobbies, etc. The structure of the view is som

Re: [firebird-support] Reading unnecessary records

2014-04-04 Thread Tim Ward
We generate the queries on the fly rather than trying to use a view, precisely because of these problems. So if CityName is not required in the output, there's no JOIN to City. And if there's something in the WHERE clause such as "HobbyCode > 27" then we know that HobbyID can't be null, which

Re: [firebird-support] Reading unnecessary records

2014-04-04 Thread fabianoaspro
I agree with Tim. Whe dont uwe views too becase this speed problem. Em 04/04/2014 08:51, "Tim Ward" escreveu: > > > We generate the queries on the fly rather than trying to use a view, > precisely because of these problems. > > So if CityName is not required in the output, there's no JOIN to City

Re: [firebird-support] Copy Table

2014-04-04 Thread Thomas Beckmann
You can do this automatically, I'll write down an example later this weekend, ok? Thomas Am 04.04.2014 13:12, schrieb atuncce...@duzen.com.tr: > > > Thank you Thomas > > Sometimes I may add fields to the master table and if I write all the > fields explicitely, I will need to modify the store

Re: [firebird-support] Copy Table

2014-04-04 Thread Woody
<< From: atuncce...@duzen.com.tr Sent: Friday, April 04, 2014 6:12 AM To: firebird-support@yahoogroups.com Subject: Re: [firebird-support] Copy Table Thank you Thomas Sometimes I may add fields to the master table and if I write all the fields explicitely, I will need to modify the stored pr

RE: [firebird-support] Reading unnecessary records

2014-04-04 Thread Leyne, Sean
> The structure of the view is something like CREATE VIEW PersonView .. > SELECT * > FROM PersonTable P > LEFT JOIN City ON City.ID =  P.CityID > LEFT JOIN Hobby ON Hobby.ID =  P.HobbyID ... > and so on for the 20 codified tables. City.ID is a primary key, like all IDs > for > remaining codificat

Re: [firebird-support] Copy Table

2014-04-04 Thread Thomas Beckmann
Hi Woody, I think, it's neither intended to, nor necessary to alter structure of old backup tables to meet current version. If I understood right, it's just intended to have a snapshot of the data on regular basis for backup purpose. I would not call it "old school", but a design decission: I'm r

Re: [firebird-support] Copy Table

2014-04-04 Thread Thomas Steinmaurer
> I want to create monthly backups of some tables by executing a procedure. > For ex, lets say I have a table named as COMPANY, and every month I want > to create a backup table named as COMPANY_BCK_2014_01, > COMPANY_BCK_2014_02 and copy the existing data into these backup tables. Unfortunately,

RE: [firebird-support] Reading unnecessary records

2014-04-04 Thread kokok_kokok
I get these data from an old app called Interbase PLAN Analizer, that works pretty well. It shows me "reads" and also the plan. I can see how Firebird includes in the plan all codification tables, when it is not strictly necessary. Something changed in FB 2.5 version. I used 1.0 for a long time

Re: [firebird-support] Copy Table

2014-04-04 Thread Thomas Beckmann
Consider attached procedure. It does not take care of calculated fields, though. That can easily be added. You might consider to add the feature of executing the statements on another, possibly remote, database/server ("execute statement on external"), but you've to be aware of possible performance

Re: [firebird-support] Copy Table

2014-04-04 Thread Thomas Beckmann
Voted. > Feel free to vote on that tracker issue: > http://tracker.firebirdsql.org/browse/CORE-796 -- Mit freundlichen Grüßen, Thomas Beckmann Diplom-Informatiker Wielandstraße 14c • 23558 Lübeck Tel +49 (22 25) 91 34 - 545 • Fax +49 (22 25) 91 34 - 604 Mail thomas.beckm...@assfinet.de

RE: [firebird-support] Reading unnecessary records

2014-04-04 Thread Leyne, Sean
> I get these data from an old app called Interbase PLAN Analizer, that works > pretty well. > It shows me "reads" and also the plan. I can see how Firebird includes in the > plan all codification tables, when it is not strictly necessary. > > Something changed in FB 2.5 version. I used 1.0 for a

Re: [firebird-support] Copy Table

2014-04-04 Thread Thomas Beckmann
Oops, it seems, I can not attach any files === create or alter procedure P_CPYTBL ( TBL varchar(31), SUFFIX varchar(10)) as declare variable CRT_STMT varchar(16000); declare variable INS_STMT varchar(16000); begin for with recursive CTE_FLD as (select trim(rf.RDB$RELATIO

RE: [firebird-support] Reading unnecessary records

2014-04-04 Thread Leyne, Sean
> I would expect that Firebird only read 10 record, however it reads 10 + > 10x20 = 210 records. > > In theory the optimizer could know that City.ID and Hobby.ID  are both > primary keys (or unique) and therefore only scan PersonTable. The engine/optimizer does know that. The engine, howeve

[firebird-support] Re: Reading unnecessary records

2014-04-04 Thread Dmitry Yemanov
04.04.2014 21:07, Leyne, Sean wrote: > > But you are assuming that because the PLAN shows that a non-referenced table > is actually being read during execution. That may not be the case. Firebird does not eliminate unreferenced tables from retrieval, so he's correct. There's no difference in th

[firebird-support] syntax for select case ...

2014-04-04 Thread James Schumacher
Hello, I am new to Firebird, I have experience using MS SQL.I am trying to convert some code that performs various checks but having problems with the syntax. One thing I need to convert is SQL to detect whether a table exists. I have tried these in Squirrel and isql connected to an em

Re: [firebird-support] syntax for select case ...

2014-04-04 Thread Thomas Beckmann
Hi James, your query has to look like select from Your example queries look like select Taking your first example, you may write SELECT case RDB$RELATION_NAME when 'SCHEMA_VERSION' then 1 else 0 end FROM RDB$RELATIONS to achieve the second. I'd write SELECT ii(RDB$RELATION

Odp: [firebird-support] Reading unnecessary records

2014-04-04 Thread liviusliv...@poczta.onet.pl
Hi, Did you use order by or group by in this view? Regards, Karol Bieniaszewski - Reply message - Od: kokok_ko...@yahoo.es Do: Temat: [firebird-support] Reading unnecessary records Data: pt., kwi 4, 2014 13:36 I use the latest version of FB 2.5. There is a view for called PERSON. Each r

Re: [firebird-support] syntax for select case ...

2014-04-04 Thread James Schumacher
Thank you for the very clear answer! I am no big fan of MS and I guess I should not be surprised that MS SQL allows non-standard constructs. I will need to unlearn some things. I just looked at this description of SQL-2003 and I see how the From clause is not optional. http://savage.net.au/S

Re: [firebird-support] Reading unnecessary records

2014-04-04 Thread Alexandre Benson Smith
Em 4/4/2014 09:31, fabianoas...@gmail.com escreveu: I agree with Tim. Whe dont uwe views too becase this speed problem. Em 04/04/2014 08:51, "Tim Ward" > escreveu: We generate the queries on the fly rather than trying to use a view, precisely because of these

[firebird-support] Snapshot back up from VB6

2014-04-04 Thread Andrew Gable
Hi Everyone, Just wondering how or if it is possible to do a snapshot back up of a Firebird database from VB6? I can get the location of the database but whenever I try to copy the file to my back up drive with in VB6 I get a error 70 Permission denied. I Do not want to use any external applicat