November 30, 2007, 04:58 PM
MacLonghorndb name parm in SQL stored proc
I'm trying to parameterize the database name for use in calling a MSSQL stored proc:
SQL SQLMSS
EX &&DBNAME.dbo.spMyProc;
I have set the &&DBNAME = 'HEPBIDEV'. WF, clever as it is, interprets the period as a WF format and concatenation and says "Could not find stored procedure 'HEPBIDEVspMyProc'. How can I avoid the concat?
December 03, 2007, 03:17 AM
Majid JeddiHi,
To avoid the concat you have to change the context inside your stored procedure.example :
use databasename.
Majid.
December 03, 2007, 02:00 PM
MacLonghornwell, that's one way to do it, but you'd have to add a parameter to every stored procedure to know if it's a test db or prod. i'd rather change my WF code instead of every SP. I've been able to do it like this:
-SET &proc = &&DBNAME | '.dbo.spMyProc'
SQL EX &proc;
any shortcuts to this?
December 03, 2007, 02:06 PM
Francis MarianiBelieve it or not, two dots (or three) after the variable name will work.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 03, 2007, 02:08 PM
Francis MarianiIt's three dots:
-SET &&DBNAME = 'EIDW';
SQL SQLMSS
EX &&DBNAME...DBO.SPMYPROC;
-RUN
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
December 03, 2007, 04:32 PM
MacLonghornExcellent. that's what I was looking for. Thanks Francis.