M
Marchand Durpis
I'm trying (and failing) to use parameters passed into stored
procedures within an IF statement in an ADP application fronting
SQL Server. Boiled down to the essence, the stored procedure code
looks like this:
Alter Procedure stpDocsList(@psOffice varchar(20), @psTypeRep varchar(20))
As
IF @psOffice = 'NYC'
SELECT Docname, docfilename, PertainsTo FROM DocsList WHERE
PertainsTo = @psTypeRep and UsedInNYC = 1
ELSE
SELECT PertainsTo FROM DocsList WHERE PertainsTo = @psTypeRep
return
The problem I'm having is that the IF portion never executes (the ELSE
always does), even when the passed parameter is 'NYC'. I've tried "
LIKE 'NYC' ", " LIKE '%NYC%' " and innumerable other variants, with
equal lack of success. So what syntax should I be using here to make
it work?
TIA,
Marchand
procedures within an IF statement in an ADP application fronting
SQL Server. Boiled down to the essence, the stored procedure code
looks like this:
Alter Procedure stpDocsList(@psOffice varchar(20), @psTypeRep varchar(20))
As
IF @psOffice = 'NYC'
SELECT Docname, docfilename, PertainsTo FROM DocsList WHERE
PertainsTo = @psTypeRep and UsedInNYC = 1
ELSE
SELECT PertainsTo FROM DocsList WHERE PertainsTo = @psTypeRep
return
The problem I'm having is that the IF portion never executes (the ELSE
always does), even when the passed parameter is 'NYC'. I've tried "
LIKE 'NYC' ", " LIKE '%NYC%' " and innumerable other variants, with
equal lack of success. So what syntax should I be using here to make
it work?
TIA,
Marchand