J
Jose Perdigao
I created a sp procedure with multi select statement.
From query analyzer, I open any select, depending of iCrint() value
The following code is example:
ALTER PROCEDURE P2_qrys
--@STR INT
AS
SET NOCOUNT ON
DECLARE @STR INT
SET @STR=dbo.iCrint()
--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-- Allocation
IF @STR=1
SELECT dDatez, Fieldd, Satellite, SepProdz, PipelineID, WellID, TestDate
FROM dbo.L1_AllocationDF
WHERE (Area LIKE dbo.iArea())
ORDER BY dDatez, Sort
--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-- Alloc Factors
IF @STR=5
SELECT dDate, Area, Source, FctOil, FctWater, FctGross, FctGas
FROM dbo.L1_AllocFctrsDF
WHERE (Area LIKE dbo.iArea())
ORDER BY dDate
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-- Chemicals
IF @STR=7
SELECT dDate, Area, ChemicalType, InjectionPoint, ChemicalName, Supplier
FROM dbo.L1_ChemicalsDF
WHERE (Area LIKE dbo.iArea())
ORDER BY dDate, Sort
RETURN
From VBA I open store procedure and sometimes works, sometimes not and
sometimes the select statement doesn't matching with the select statement.
If in the query analyzer I can open the right statement what is wrong? What
can I do?
What I need is:
I have many and many queries. I can create one store procedure for each
query, I did and works fine.
But I would like reduce the number of queries, so I think, I can create a sp
with multi SELECTs and with function IF, I would like to open the query that
I wihs.
Any suggestions?
Thanks,
JP
From query analyzer, I open any select, depending of iCrint() value
The following code is example:
ALTER PROCEDURE P2_qrys
--@STR INT
AS
SET NOCOUNT ON
DECLARE @STR INT
SET @STR=dbo.iCrint()
--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-- Allocation
IF @STR=1
SELECT dDatez, Fieldd, Satellite, SepProdz, PipelineID, WellID, TestDate
FROM dbo.L1_AllocationDF
WHERE (Area LIKE dbo.iArea())
ORDER BY dDatez, Sort
--xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-- Alloc Factors
IF @STR=5
SELECT dDate, Area, Source, FctOil, FctWater, FctGross, FctGas
FROM dbo.L1_AllocFctrsDF
WHERE (Area LIKE dbo.iArea())
ORDER BY dDate
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-- Chemicals
IF @STR=7
SELECT dDate, Area, ChemicalType, InjectionPoint, ChemicalName, Supplier
FROM dbo.L1_ChemicalsDF
WHERE (Area LIKE dbo.iArea())
ORDER BY dDate, Sort
RETURN
From VBA I open store procedure and sometimes works, sometimes not and
sometimes the select statement doesn't matching with the select statement.
If in the query analyzer I can open the right statement what is wrong? What
can I do?
What I need is:
I have many and many queries. I can create one store procedure for each
query, I did and works fine.
But I would like reduce the number of queries, so I think, I can create a sp
with multi SELECTs and with function IF, I would like to open the query that
I wihs.
Any suggestions?
Thanks,
JP