Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 5 of 5 total |
More Problems with Params in Stored Procs |
Tue, Mar 4 2008 5:56 AM | Permanent Link |
Peter Thorne | Tim,
I am still having problems passing parameters to stored procs BEGIN DECLARE Result CURSOR WITH RETURN FOR Stmt; BEGIN PREPARE Stmt FROM 'BACKUP DATABASE TTWNN AS ? TO ? TABLES ImpExModel'; OPEN Result USING DBName, DirName; END; END Throws a db error 700 'Expected backup name but instead found ?' irrespective of whether I paramterise with "TestBackup" / 'C:\backups' or TestBackup / C:\backups I have also tried BEGIN DECLARE Query STATEMENT; PREPARE Query FROM 'BACKUP DATABASE TTWNN AS ? TO ? TABLES ImpExModel'; EXECUTE USING DBName, DirName; END with the same result. Peter |
Tue, Mar 4 2008 3:11 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Peter,
<< Throws a db error 700 'Expected backup name but instead found ?' irrespective of whether I paramterise with "TestBackup" / 'C:\backups' or TestBackup / C:\backups >> You can't use parameters in a BACKUP DATABASE statement. You need to build the statement dynamically: BEGIN EXECUTE IMMEDIATE 'BACKUP DATABASE TTWNN AS "'+DBName+'" TO '''+DirName+''' TABLES ImpExModel'; END -- Tim Young Elevate Software www.elevatesoft.com |
Wed, Mar 5 2008 3:29 AM | Permanent Link |
Peter Thorne | OK. Thanks Tim. I presume that in this instance DBName and DirName are delared variables in the proc?
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote: << You can't use parameters in a BACKUP DATABASE statement. You need to build the statement dynamically: BEGIN EXECUTE IMMEDIATE 'BACKUP DATABASE TTWNN AS "'+DBName+'" TO '''+DirName+''' TABLES ImpExModel'; END >> |
Wed, Mar 5 2008 4:47 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Peter
NOt having written any SPs yet I would have thought IN parameters Roy Lambert |
Wed, Mar 5 2008 10:46 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Peter,
<< OK. Thanks Tim. I presume that in this instance DBName and DirName are delared variables in the proc? >> It's up to you - you can declare them as variables and assign them values inside of the SP, or you can declare them as input parameters like Roy suggests. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Sunday, May 5, 2024 at 07:30 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |