Focal Point
db name parm in SQL stored proc

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6111095952

November 30, 2007, 04:58 PM
MacLonghorn
db 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?


Thanks.

Mark
WF 7.6 Windows
December 03, 2007, 03:17 AM
Majid Jeddi
Hi,

To avoid the concat you have to change the context inside your stored procedure.example :
use databasename.

Majid.


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
December 03, 2007, 02:00 PM
MacLonghorn
well, 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?


Thanks.

Mark
WF 7.6 Windows
December 03, 2007, 02:06 PM
Francis Mariani
Believe 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 Mariani
It'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
MacLonghorn
Excellent. that's what I was looking for. Thanks Francis.


Thanks.

Mark
WF 7.6 Windows