Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 22 total
Thread SQL scripts
Thu, Jan 4 2007 3:25 AMPermanent Link

"Harry de Boer"
Tim,

Do I understand correctly -reading the posts so far- that multiple sql
statements (scripts) are not possible in EDB? That would be a real killer
for me (or is there a workaround?). Does this mean you can't create a
database from a script?  Considering the delphi code underneath (used in
several apps for charting 'on the fly'): would such still be possible in
EDB?

Regards, Harry

   for i := 0 to Length(Ajaren) - 1 do begin //max 5
     sSelect := '';
     if i = 0 then sSelect := sSelect + 'DROP TABLE IF EXISTS memory
tempTL_OV0;';
     if i = 1 then sSelect := sSelect + 'DROP TABLE IF EXISTS memory
tempTL_OV1;';
     if i = 2 then sSelect := sSelect + 'DROP TABLE IF EXISTS memory
tempTL_OV2;';
     if i = 3 then sSelect := sSelect + 'DROP TABLE IF EXISTS memory
tempTL_OV3;';
     if i = 4 then sSelect := sSelect + 'DROP TABLE IF EXISTS memory
tempTL_OV4;';
     sSelect := sSelect + 'SELECT ';
     sSelect := sSelect + ' extract(month from Datum) AS maand,';
     sSelect := sSelect + ' COUNT(teller) AS bedr';
     sSelect := sSelect + ' INTO memory tempTL_OV' + IntToStr(i);
     sSelect := sSelect + ' FROM contracten, contractregels';
     sSelect := sSelect + ' WHERE extract(year from Datum_van) = ' +
aJaren[i];
     sSelect := sSelect + ' AND extract(year from Datum) = ' +
IntToSTr(StrToInt(aJaren[i]) -1);
     sSelect := sSelect + ' AND contracten.id_contract =
contractregels.id_contract';
     if frmMain.sO <> '()' then sSelect := sSelect + ' AND
Id_Object_Artikel IN ' + frmMain.sO
     else sSelect := sSelect + ' AND Object_of_Artikel = "O"' ;
     sSelect := sSelect + ' AND geannuleerd = Null';
     sSelect := sSelect + ' GROUP BY maand;';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(1,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(2,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(3,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(4,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(5,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(6,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(7,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(8,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(9,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(10,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(11,0);';
     sSelect := sSelect + 'INSERT INTO memory tempTL_OV' + IntToStr(i) + '
VALUES(12,0);';
     sSelect := sSelect + 'SELECT maand, RUNSUM(bedr) totaal FROM memory
tempTL_OV' + IntToStr(i) + ' GROUP BY maand;';
     //--
     if i = 0 then begin
       q1.Close;
       q1.SQL.Clear;
       q1.SQL.Add(sSelect);
       q1.ExecSQL;
      ..........

Thu, Jan 4 2007 4:47 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Harry,

<< Do I understand correctly -reading the posts so far- that multiple sql
statements (scripts) are not possible in EDB? >>

Dynamically, no.  As a stored procedure, yes.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Jan 4 2007 9:19 PMPermanent Link

"Surjanto"
Permanently ?

I vote for SQL scripts if permitted Smile


Surjanto

Thu, Jan 4 2007 11:00 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Surjanto,

<< Permanently ? >>

No, only initially.  See this thread:

http://www.elevatesoft.com/scripts/newsgrp.dll?action=openmsg&group=19&msg=80&page=1#msg80

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jan 5 2007 4:27 AMPermanent Link

"Jose Eduardo Helminsky"
Tim

Then the script:

select cod,nom into memory\m1 from table1 where <some_condition>
;
select * from table2 where key in (select cod from memory\m1)

As I understood, the above script will not work ?

I hope, I am wrong...

Eduardo

Fri, Jan 5 2007 4:48 AMPermanent Link

"Harry de Boer"
Tim,

Does this mean that the code I showed cannot be used (I guess an SP is not
the solution here, or can this be rewritten in a SP?). If SQL scripts
initialy are not in EDB, will they be there soon? I don't kow -and don't
want to speak for others- if other users use them a lot, but as I see it it
prevents us from using EDB initially (given the my code example: we use
these kind of *dynamic* sql a lot).

Regards, Harry


"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> schreef in bericht
news:C00CC823-FA6D-46BD-B93E-968BF20A94BD@news.elevatesoft.com...
> Harry,
>
> << Do I understand correctly -reading the posts so far- that multiple sql
> statements (scripts) are not possible in EDB? >>
>
> Dynamically, no.  As a stored procedure, yes.
>
> --
> Tim Young
> Elevate Software
> www.elevatesoft.com
>
>

Fri, Jan 5 2007 5:11 AMPermanent Link

Steve Forbes

Team Elevate Team Elevate

Hi Harry,

> (given the my code example: we use these kind of *dynamic* sql a lot).

I do too

--
Best regards

Steve

"Harry de Boer" <harry@staaf.nl> wrote in message
news:F63589A1-97E5-4A7E-A502-2CBD761B451C@news.elevatesoft.com...
> Tim,
>
> Does this mean that the code I showed cannot be used (I guess an SP is not
> the solution here, or can this be rewritten in a SP?). If SQL scripts
> initialy are not in EDB, will they be there soon? I don't kow -and don't
> want to speak for others- if other users use them a lot, but as I see it
> it
> prevents us from using EDB initially (given the my code example: we use
> these kind of *dynamic* sql a lot).
>
> Regards, Harry

Fri, Jan 5 2007 5:55 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ditto

Roy Lambert
Fri, Jan 5 2007 8:09 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Count me as well

Chris Holland


Roy Lambert wrote:
> Ditto
>
> Roy Lambert
>
Fri, Jan 5 2007 2:11 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Harry,

<< Does this mean that the code I showed cannot be used (I guess an SP is
not the solution here, or can this be rewritten in a SP?). >>

That most certainly can be written as a SP.  In fact, the looping can be
included also.

<< If SQL scripts initialy are not in EDB, will they be there soon? >>

Probably.  However, remember that scripts will simply be a way of executing
a stored procedure in an ad-hoc fashion without creating the stored
procedure first.  That's the only difference between the two.  Think of a
stored procedure as a parameterized dynamic script.

--
Tim Young
Elevate Software
www.elevatesoft.com

Page 1 of 3Next Page »
Jump to Page:  1 2 3
Image