Hi Everyone
I am trying to get a paramter to be a literal string in a table join for the view that the procedure creates.
For example I pass in 'D01PAYE1T', 'D01' for the parameters.
The @PAYLIB works great, it just I can figure out the single quote logic to force the @District to be considered a string in this statement. Wondering if anyone can help me out here.
The error I get when I run this is Message: [SQL0010] String constant beginning ', ?)
I am trying to get a paramter to be a literal string in a table join for the view that the procedure creates.
For example I pass in 'D01PAYE1T', 'D01' for the parameters.
The @PAYLIB works great, it just I can figure out the single quote logic to force the @District to be considered a string in this statement. Wondering if anyone can help me out here.
Code:
CREATE PROCEDURE TRANSFER.F5560116JA_CREATE_PROC (IN @PAYLIB VARCHAR(10), IN @District VARCHAR(3) ) BEGIN DECLARE STMT1 VARCHAR ( 8000 ) ; SET STMT1 = 'Create View ' || @PAYLIB || '.F5560116JA as SELECT DISTINCT F060116.YAAN8 FROM ' || @PAYLIB || '.F060116 AS F060116 LEFT OUTER JOIN D99HRISDV.F56HRISFID F56HRISFID ON ''' || @District || ''' RIGHT(''00000'' || F060116.YAAN8,5) = F56HRISFID.GIN' EXECUTE IMMEDIATE STMT1 ; END;
Comment