Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread What is wrong with this script?
Fri, Oct 5 2012 12:43 PMPermanent Link

Abdulaziz Al-Jasser

Hi,

I have two databases:

1- "MyDatabase" which is a local database.
2- "RAM" which a memory database.

I wrote a ascript which will be run later inside a job but I get an error in the fourth line (CREATE TABLE "RAM"."Invoices" AS)!  This my script:


SCRIPT
BEGIN
EXECUTE IMMEDIATE
'CREATE TABLE "RAM"."Invoices" AS
SELECT * FROM MyDatabase.TB_Invoices
WHERE BranchSysNo = 1 AND InvoiceType = 0 WITH DATA';
--------------------------------------------------------
EXECUTE IMMEDIATE
'EXPORT TABLE RAM.Invoices
TO "Invoices.txt"
IN STORE "LocalStore"';
--------------------------------------------------------
EXECUTE IMMEDIATE 'DROP TABLE RAM.Invoices';
--------------------------------------------------------
--EXECUTE IMMEDIATE '
--COPY FILE "Invoices.txt" IN STORE "LocalStore"
--TO "Invoices.txt" IN STORE "RemoteStore"';
--------------------------------------------------------
--------------------------------------------------------
--------------------------------------------------------
EXECUTE IMMEDIATE
'CREATE TABLE "RAM"."Sales" AS
SELECT * FROM MyDatabase.TB_Sales
WHERE BranchSysNo = 1 WITH DATA';
--------------------------------------------------------
EXECUTE IMMEDIATE
'EXPORT TABLE RAM.Sales
TO "Sales.txt"
IN STORE "LocalStore"';
--------------------------------------------------------
EXECUTE IMMEDIATE 'DROP TABLE RAM.Sales';
--------------------------------------------------------
--EXECUTE IMMEDIATE '
--COPY FILE "Sales.txt" IN STORE "LocalStore"
--TO "Sales.txt" IN STORE "RemoteStore"';
--------------------------------------------------------


Any idea what is wrong?

Regards,
Abdulaziz Jasser
Fri, Oct 5 2012 1:37 PMPermanent Link

Uli Becker

Abdulaziz,

> I wrote a ascript which will be run later inside a job but I get an
error in the fourth line (CREATE TABLE "RAM"."Invoices" AS)!  This my
script:

Though you don't post the exact error message (why not?), I guess you
got this error:

Invalid expression . found, schema qualifier not allowed

Your syntax is wrong.

Use this instead:

SCRIPT
BEGIN

   USE "RAM";
   EXECUTE IMMEDIATE 'CREATE TABLE "Invoices" AS
   SELECT * FROM MyDatabase.TB_Invoices
   WHERE BranchSysNo = 1 AND InvoiceType = 0 WITH DATA';

   ...

END

Uli

Fri, Oct 5 2012 2:15 PMPermanent Link

Abdulaziz Al-Jasser

Uli,
<<Though you don't post the exact error message (why not?), I guess you
got this error:

Invalid expression . found, schema qualifier not allowed

Your syntax is wrong.>>

You are totally right.  Thanks for the help.
Regards,
Abdulaziz Jasser
Image