Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Specify Database in Job
Thu, Jul 2 2009 3:49 PMPermanent Link

"Ivan Sine"
How do I specify that "only" the tables from the database "Assessors" get
exported. Right now the script exports system tables.

SCRIPT
BEGIN

DECLARE DBCursor CURSOR FOR DBStmt;
DECLARE TblName VARCHAR DEFAULT '';
PREPARE DBStmt FROM 'SELECT Name FROM Information.Tables';

OPEN DBCursor;
FETCH FIRST FROM DBCursor (Name) INTO tblName;
WHILE NOT EOF(DBCursor) DO
 EXECUTE IMMEDIATE 'EXPORT TABLE "' + TblName + '" TO "' + TblName + '.csv"
IN STORE "Exports"';
 FETCH NEXT FROM DBCursor (Name) INTO TblName;
END WHILE;
CLOSE DBCursor;
END
Thu, Jul 2 2009 7:45 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Ivan,

You may use the USE statement to open the "Assessors" database:

SCRIPT
BEGIN
  DECLARE DBCursor CURSOR FOR DBStmt;
  DECLARE TblName VARCHAR DEFAULT '';

  USE "Assessors" ;
  PREPARE DBStmt FROM 'SELECT Name FROM Information.Tables';
  ...
  CLOSE DBCursor;
  USE ;

END

You can find more information about this statement here:
http://www.elevatesoft.com/manual?action=mantopic&id=edb2sql&category=13&topic=234


--
Fernando Dias
[Team Elevate]
Fri, Jul 3 2009 9:48 AMPermanent Link

"Ivan Sine"
Thanks!
Image