I have the following stored proc which is trying to:
- Execute system stored procedure (sp_monitorconfig) and put the result set into a temp table.
- SELECT FROM this temp table and add 2 custom columns (SOURCESERVER & CollectionTime)
- This final result set will be ingested into Logstash via jdbc job.
I'm currently using SAP ASE 16 (sybase) and am getting an incorrect syntax error at keyword 'exec'. I'm not sure if I have to prefix the stored proc or what, but I'm currently stumped and any help is appreciated.
USE db
GO
CREATE PROCEDURE sp_active_con_ratio.sql AS
DECLARE @servername varchar(32) DECLARE @collecttime DATETIME DECLARE @procparam varchar(32)
select
@servername = @@servername
select
@collecttime = getdate()
select
@procparam = 'number of user connections' CREATE TABLE #TempUserConnections
(
TempName varchar(35),
FreeConnections int,
ActiveConnections int,
PercentActive char(6),
MaxUsed int,
Reuse_cnt int,
Instance_Name varchar(30) NULL
)
INSERT INTO
#TempUserConnections (TempName, FreeConnections, ActiveConnections, PercentActive, MaxUsed, Reuse_cnt, Instance_Name)
exec sp_monitorconfig @procparam **ERROR HERE**
SELECT
@servername AS 'SOURCESERVER',
FreeConnections,
ActiveConnections,
PercentActive,
MaxUsed,
@collecttime AS 'CollectionTime'
FROM
#TempUserConnections
DROP TABLE #TempUserConnections
RETURN
GO
Thanks!