![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 6 of 6 total |
![]() |
Mon, Nov 19 2007 6:16 AM | Permanent Link |
"Jochem Stemmermann" | Hi,
this Jobcode : BEGIN DECLARE DBCursor CURSOR FOR DBStmt; DECLARE DBName VARCHAR DEFAULT ''; PREPARE DBStmt FROM 'SELECT * FROM Databases'; OPEN DBCursor; FETCH FIRST FROM DBCursor (Name) INTO DBName; WHILE NOT EOF(DBCursor) DO EXECUTE IMMEDIATE 'BACKUP DATABASE"' + DBName + '" AS ' + CAST(CURRENT_DATE AS VARCHAR(10)) + '-' + DBName + '" TO ''\Backups'' INCLUDE CATALOG'; FETCH NEXT FROM DBCursor (Name) INTO DBName; END WHILE; CLOSE DBCursor; END return Error 700 : An error was found in the statement at line 1 and column 35 (Expected backup name but instead found 2007) Any suggestions appreciated regards Jochem |
Mon, Nov 19 2007 3:21 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Jochen,
Enclose the backup name in double-quotes since it is an identifier: BEGIN DECLARE DBCursor CURSOR FOR DBStmt; DECLARE DBName VARCHAR DEFAULT ''; PREPARE DBStmt FROM 'SELECT * FROM Databases'; OPEN DBCursor; FETCH FIRST FROM DBCursor (Name) INTO DBName; WHILE NOT EOF(DBCursor) DO EXECUTE IMMEDIATE 'BACKUP DATABASE "' + DBName + '" AS "' + CAST(CURRENT_DATE AS VARCHAR(10)) + '-' + DBName + '" TO ''\Backups'' INCLUDE CATALOG'; FETCH NEXT FROM DBCursor (Name) INTO DBName; END WHILE; CLOSE DBCursor; END -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Nov 19 2007 3:24 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Jochem,
BTW, I noticed that the error (missing double-quote) came from our manual. I've corrected the CREATE JOB and ALTER JOB example so that they now work correctly. -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Nov 19 2007 4:14 PM | Permanent Link |
"Jochem Stemmermann" | thank you yery much
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> schrieb im Newsbeitrag news:7084CDC2-10D5-4B3D-8D9C-38B432D8F98A@news.elevatesoft.com... > Jochem, > > BTW, I noticed that the error (missing double-quote) came from our manual. > I've corrected the CREATE JOB and ALTER JOB example so that they now work > correctly. > > -- > Tim Young > Elevate Software > www.elevatesoft.com > |
Mon, Nov 19 2007 4:21 PM | Permanent Link |
"Jochem Stemmermann" | Sorry, next error on your sample
error 200 : This operation cannot be performed on the system database Configuration or any privileges granted to it best regards Jochem "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> schrieb im Newsbeitrag news:9D6CDCEE-6A39-4999-9BE0-C2DE15253C5C@news.elevatesoft.com... > Jochen, > > Enclose the backup name in double-quotes since it is an identifier: > > BEGIN > DECLARE DBCursor CURSOR FOR DBStmt; > DECLARE DBName VARCHAR DEFAULT ''; > > PREPARE DBStmt FROM 'SELECT * FROM Databases'; > OPEN DBCursor; > > FETCH FIRST FROM DBCursor (Name) INTO DBName; > WHILE NOT EOF(DBCursor) DO > EXECUTE IMMEDIATE 'BACKUP DATABASE "' + DBName + '" AS "' + > CAST(CURRENT_DATE AS VARCHAR(10)) + > '-' + DBName + '" TO ''\Backups'' INCLUDE CATALOG'; > FETCH NEXT FROM DBCursor (Name) INTO DBName; > END WHILE; > > CLOSE DBCursor; > END > > -- > Tim Young > Elevate Software > www.elevatesoft.com > |
Tue, Nov 20 2007 3:14 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Jochem,
<< Sorry, next error on your sample error 200 : This operation cannot be performed on the system database Configuration or any privileges granted to it >> Sorry about that. The code needs to skip the Configuration database: BEGIN DECLARE DBCursor CURSOR FOR DBStmt; DECLARE DBName VARCHAR DEFAULT ''; PREPARE DBStmt FROM 'SELECT * FROM Databases'; OPEN DBCursor; FETCH FIRST FROM DBCursor (Name) INTO DBName; WHILE NOT EOF(DBCursor) DO BEGIN IF (DBName <> 'Configuration') THEN EXECUTE IMMEDIATE 'BACKUP DATABASE "' + DBName + '" AS "' + CAST(CURRENT_DATE AS VARCHAR(10)) + '-' + DBName + '" TO ''\Backups'' INCLUDE CATALOG'; END IF; FETCH NEXT FROM DBCursor (Name) INTO DBName; END; END WHILE; CLOSE DBCursor; END -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |